|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.util.DeepObject
com.threerings.editor.Property
public abstract class Property
Provides access to an editable property of an object.
| Field Summary | |
|---|---|
protected HashMap<Class<?>,Class<?>[]> |
_argumentTypes
Cached argument types. |
protected static HashMap<String,Class<?>[]> |
_configTypes
Class |
protected HashMap<Class<?>,Type[]> |
_genericArgumentTypes
Cached generic argument types. |
protected String |
_name
The property name. |
| Constructor Summary | |
|---|---|
Property()
|
|
| Method Summary | ||
|---|---|---|
protected static void |
addSubtypes(Class<?> clazz,
Collection<Class<?>> types)
Adds the subtypes of the specified class to the provided list. |
|
protected static void |
addSubtypes(EditorTypes annotation,
Collection<Class<?>> types)
Adds the subtypes listed in the provided annotation to the supplied list. |
|
abstract Object |
get(Object object)
Retrieves the value of the property. |
|
Editable |
getAnnotation()
Returns a reference to the Editable annotation, which contains simple constraints. |
|
|
getAnnotation(Class<T> clazz)
Returns a reference to the annotation of the specified class, if it exists. |
|
Class<?> |
getArgumentType(Class<?> clazz)
Given a generic class or interface, determines the first actual type argument provided to the given type (for example, passing Collection can be used to determine the type of
collection). |
|
Class<?>[] |
getArgumentTypes(Class<?> clazz)
Given a generic class or interface, determines the actual type arguments provided to the given type (for example, passing Collection can be used to determine the type of
collection). |
|
boolean |
getBoolean(Object object)
Retrieves the value of the property. |
|
byte |
getByte(Object object)
Retrieves the value of the property. |
|
char |
getChar(Object object)
Retrieves the value of the property. |
|
String |
getColorName()
Returns the name of the color lookup for the property. |
|
Class<?>[] |
getComponentSubtypes()
Returns an array containing the available subtypes for components of this (array or collection) type. |
|
Class<?> |
getComponentType()
Returns the component type of this (array or collection) type. |
|
String |
getComponentTypeLabel()
Returns the type label for subtypes of this (array or collection) type's components. |
|
double |
getDouble(Object object)
Retrieves the value of the property. |
|
protected EditorTypes |
getEditorTypes(Class<?> type)
Returns the editor types annotation on the property, if it exists, or on the specified type, if that exists, or null if neither one exists. |
|
float |
getFloat(Object object)
Retrieves the value of the property. |
|
Type |
getGenericArgumentType(Class<?> clazz)
Given a generic class or interface, determines the first actual type argument provided to the given type (for example, passing Collection can be used to determine the type of
collection). |
|
Type[] |
getGenericArgumentTypes(Class<?> clazz)
Given a generic class or interface, determines the actual type arguments provided to the given type (for example, passing Collection can be used to determine the type of
collection). |
|
Type |
getGenericComponentType()
Returns the generic component type of this (array or collection) type. |
|
abstract Type |
getGenericType()
Returns the generic property type. |
|
int |
getInt(Object object)
Retrieves the value of the property. |
|
long |
getLong(Object object)
Retrieves the value of the property. |
|
double |
getMaximum()
Returns the maximum value. |
|
int |
getMaxSize()
Returns the maximum size; |
|
abstract Member |
getMember()
Returns the underlying member of the property (the field or method that provides the annotations). |
|
Object |
getMemberObject(Object object)
Returns a reference to the member object (the object to whose member getMember()
refers, given the object one would pass to get(java.lang.Object) or set(java.lang.Object, java.lang.Object)). |
|
String |
getMessageBundle()
Returns the name of the message bundle to use when translating the property name and other bits. |
|
double |
getMinimum()
Returns the minimum value. |
|
int |
getMinSize()
Returns the minimum size. |
|
String |
getMode()
Returns the mode string. |
|
String |
getName()
Returns the name of the property. |
|
double |
getScale()
Returns the scale value. |
|
short |
getShort(Object object)
Retrieves the value of the property. |
|
double |
getStep()
Returns the step value. |
|
Class<?>[] |
getSubtypes()
Returns an array containing the available subtypes of this type. |
|
protected Class<?>[] |
getSubtypes(Class<?> type)
Returns an array containing the available subtypes of the specified type, first looking to subtypes listed in the annotation, then attempting to find a method using reflection. |
|
abstract Class<?> |
getType()
Returns the property type. |
|
protected static Type[] |
getTypeArguments(Class<?> type,
Type[] args,
Class<?> clazz)
Returns the arguments of the provided generic class or interface. |
|
protected static Type[] |
getTypeArguments(Type type,
Class<?> clazz)
Given a generic class or interface, determines the actual type arguments provided to the given type (for example, passing Collection can be used to determine the type of
collection). |
|
protected static Type[] |
getTypeArguments(Type type,
TypeVariable[] params,
Type[] values,
Class<?> clazz)
Returns the arguments of the provided generic class or interface. |
|
protected Class<?> |
getTypeClass(Type type)
Returns the underlying class of the supplied type. |
|
String |
getTypeLabel()
Returns the type label for subtypes of this type. |
|
protected String |
getTypeLabel(Class<?> type)
Returns the label for subtypes of the specified type. |
|
String |
getUnits()
Returns the units string. |
|
boolean |
isAnnotationPresent(Class<? extends Annotation> clazz)
Determines whether the property has an annotation of the specified class. |
|
boolean |
isLegalValue(Object value)
Determines whether the supplied value is legal for this property. |
|
abstract void |
set(Object object,
Object value)
Sets the value of the property. |
|
void |
setBoolean(Object object,
boolean value)
Sets the value of the property. |
|
void |
setByte(Object object,
byte value)
Sets the value of the property. |
|
void |
setChar(Object object,
char value)
Sets the value of the property. |
|
void |
setDouble(Object object,
double value)
Sets the value of the property. |
|
void |
setFloat(Object object,
float value)
Sets the value of the property. |
|
void |
setInt(Object object,
int value)
Sets the value of the property. |
|
void |
setLong(Object object,
long value)
Sets the value of the property. |
|
void |
setShort(Object object,
short value)
Sets the value of the property. |
|
boolean |
shouldTranslateName()
Returns whether or not we should attempt to translate the name. |
|
String |
toString()
|
|
| Methods inherited from class com.threerings.util.DeepObject |
|---|
clone, copy, copy, equals, hashCode |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String _name
@DeepOmit protected HashMap<Class<?>,Class<?>[]> _argumentTypes
@DeepOmit protected HashMap<Class<?>,Type[]> _genericArgumentTypes
protected static HashMap<String,Class<?>[]> _configTypes
| Constructor Detail |
|---|
public Property()
| Method Detail |
|---|
public String getName()
public boolean shouldTranslateName()
public String getColorName()
public Class<?>[] getSubtypes()
public Class<?>[] getComponentSubtypes()
public String getTypeLabel()
public String getComponentTypeLabel()
public String getMessageBundle()
public abstract Member getMember()
public Object getMemberObject(Object object)
getMember()
refers, given the object one would pass to get(java.lang.Object) or set(java.lang.Object, java.lang.Object)).
public abstract Class<?> getType()
public abstract Type getGenericType()
public Class<?> getComponentType()
public Type getGenericComponentType()
public Class<?> getArgumentType(Class<?> clazz)
Collection can be used to determine the type of
collection).
null if not
found.public Class<?>[] getArgumentTypes(Class<?> clazz)
Collection can be used to determine the type of
collection).
null if not found.public Type getGenericArgumentType(Class<?> clazz)
Collection can be used to determine the type of
collection).
null if not
found.public Type[] getGenericArgumentTypes(Class<?> clazz)
Collection can be used to determine the type of
collection).
null if not found.public boolean isLegalValue(Object value)
public String getMode()
public String getUnits()
public double getMinimum()
public double getMaximum()
public double getStep()
public double getScale()
public int getMinSize()
public int getMaxSize()
public Editable getAnnotation()
Editable annotation, which contains simple constraints.
public boolean isAnnotationPresent(Class<? extends Annotation> clazz)
public <T extends Annotation> T getAnnotation(Class<T> clazz)
public boolean getBoolean(Object object)
public byte getByte(Object object)
public char getChar(Object object)
public double getDouble(Object object)
public float getFloat(Object object)
public int getInt(Object object)
public long getLong(Object object)
public short getShort(Object object)
public abstract Object get(Object object)
public void setBoolean(Object object,
boolean value)
public void setByte(Object object,
byte value)
public void setChar(Object object,
char value)
public void setDouble(Object object,
double value)
public void setFloat(Object object,
float value)
public void setInt(Object object,
int value)
public void setLong(Object object,
long value)
public void setShort(Object object,
short value)
public abstract void set(Object object,
Object value)
public String toString()
toString in class DeepObjectprotected String getTypeLabel(Class<?> type)
protected Class<?>[] getSubtypes(Class<?> type)
protected EditorTypes getEditorTypes(Class<?> type)
null if neither one exists.
protected static Type[] getTypeArguments(Type type,
Class<?> clazz)
Collection can be used to determine the type of
collection).
null if not found.
protected static Type[] getTypeArguments(Class<?> type,
Type[] args,
Class<?> clazz)
type - the class to search.args - the class arguments.clazz - the generic class or interface of interest.
null if not found.
protected static Type[] getTypeArguments(Type type,
TypeVariable[] params,
Type[] values,
Class<?> clazz)
type - the type to search.params - the parameters to replace if the type is parameterized.values - the values with which to replace each parameter.clazz - the generic class of interface of interest.
null if
not found.protected Class<?> getTypeClass(Type type)
protected static void addSubtypes(EditorTypes annotation,
Collection<Class<?>> types)
protected static void addSubtypes(Class<?> clazz,
Collection<Class<?>> types)
EditorTypes annotation, the classes therein will be added; otherwise, the
class itself will be added.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||