|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.rococoa.contrib.AbstractPropertyDictionary<E>
E
- the enumerated type of the keys used with this dictionarypublic abstract class AbstractPropertyDictionary<E extends Enum<E> & NativeEnum<?>>
Wraps an NSMutableDictionary
with a set of keys defined by
a Java enumeration. Also provides convenience methods for converting between
Java and Cocoa types for the values.
Constructor Summary | |
---|---|
protected |
AbstractPropertyDictionary(int initialCapacity)
Construct a new empty dictionary with the given initial capacity. |
protected |
AbstractPropertyDictionary(NSDictionary data)
Construct a new dictionary with the given dictionary. |
protected |
AbstractPropertyDictionary(NSMutableDictionary data)
Construct a new dictionary with the given dictionary. |
Method Summary | ||
---|---|---|
boolean |
getBoolean(E key)
Get the value associated with the given key as a boolean |
|
NSMutableDictionary |
getData()
Get the underlying dictionary |
|
Date |
getDate(E key)
Get the value associated with the given key as a Date |
|
|
getEnum(Class<EN> nativeEnum,
E key)
Get the value associated with the given key as an enum |
|
int |
getInt(E key)
Get the value associated with the given key as an int |
|
short |
getShort(E key)
Get the value associated with the given key as a short |
|
String |
getString(E key)
Get the value associated with the given key as a String |
|
|
getValueAsType(E key,
Class<R> type)
Get the value associated with the given key as coercing it to the given type. |
|
void |
setDate(E key,
Date date)
Set the value associated with the given key. |
|
void |
setString(E key,
String value)
Set the value associated with the given key. |
|
void |
setValue(E key,
NSObject value)
Set the value associated with the given key. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractPropertyDictionary(int initialCapacity)
initialCapacity
- the initial capacity to useprotected AbstractPropertyDictionary(NSMutableDictionary data)
data
- the dictionary to useprotected AbstractPropertyDictionary(NSDictionary data)
data
- the dictionary to useMethod Detail |
---|
public NSMutableDictionary getData()
public String getString(E key)
key
- the key whose associated value will be returned
public void setString(E key, String value)
key
- the key whose value will be setvalue
- the value to setpublic int getInt(E key)
key
- the key whose associated value will be returned
public short getShort(E key)
key
- the key whose associated value will be returned
public boolean getBoolean(E key)
key
- the key whose associated value will be returned
public Date getDate(E key)
key
- the key whose associated value will be returned
public void setDate(E key, Date date)
key
- the key whose value will be setdate
- the value to setpublic <EN extends Enum<EN> & NativeEnum<?>> EN getEnum(Class<EN> nativeEnum, E key)
EN
- the type of enum to returnkey
- the key whose associated value will be returnednativeEnum
- the class of the enum, used to resolve native values to the corresponding Java enum values
public <R extends NSObject> R getValueAsType(E key, Class<R> type)
R
- the type to returnkey
- the key whose associated value will be returnedtype
- the subclass of NSObject
that the value associated with key
will be coerced to
type
public void setValue(E key, NSObject value)
key
- the key whose value will be setvalue
- the value to setpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |