1 23 package com.sun.enterprise.management; 24 25 26 import java.util.Map ; 27 import java.util.HashMap ; 28 import java.util.Collections ; 29 30 31 33 public final class Capabilities 34 { 35 private final HashMap <String ,Object > mItems; 36 37 public static final String OFFLINE_KEY = "Offline"; 38 39 public 40 Capabilities() 41 { 42 mItems = new HashMap <String ,Object >(); 43 } 44 45 public 46 Capabilities( final Object [] pairs ) 47 { 48 this(); 49 for( int i = 0; i < pairs.length; i +=2 ) 50 { 51 add( (String )pairs[ i ], pairs[ i + 1] ); 52 } 53 } 54 55 public Map <String ,Object > 56 getAll() 57 { 58 return Collections.unmodifiableMap( mItems ); 59 } 60 61 62 public boolean getOfflineCapable() 63 { 64 return "true".equals( "" + mItems.get( OFFLINE_KEY ) ); 65 } 66 67 public void setOfflineCapable( boolean value ) 68 { 69 add( OFFLINE_KEY, "" + value ); 70 } 71 72 public void 73 add( final String key, final Object value ) 74 { 75 assert( ! mItems.containsKey( key ) ); 76 mItems.put( key, value ); 77 } 78 }; 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | Popular Tags |