com.threerings.editor
Class Property

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.editor.Property
All Implemented Interfaces:
Copyable, Cloneable
Direct Known Subclasses:
FieldProperty, MethodProperty, PathProperty

public abstract class Property
extends DeepObject

Provides access to an editable property of an object.


Constructor Summary
Property()
           
 
Method Summary
abstract  Object get(Object object)
          Retrieves the value of the property.
 Editable getAnnotation()
          Returns a reference to the Editable annotation, which contains simple constraints.
<T extends Annotation>
T
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.
 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.
abstract  Class<?> getType()
          Returns the property type.
 String getTypeLabel()
          Returns the type label for subtypes of this 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
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

public Property()
Method Detail

getName

public String getName()
Returns the name of the property.


shouldTranslateName

public boolean shouldTranslateName()
Returns whether or not we should attempt to translate the name.


getColorName

public String getColorName()
Returns the name of the color lookup for the property.


getSubtypes

public Class<?>[] getSubtypes()
Returns an array containing the available subtypes of this type.


getComponentSubtypes

public Class<?>[] getComponentSubtypes()
Returns an array containing the available subtypes for components of this (array or collection) type.


getTypeLabel

public String getTypeLabel()
Returns the type label for subtypes of this type.


getComponentTypeLabel

public String getComponentTypeLabel()
Returns the type label for subtypes of this (array or collection) type's components.


getMessageBundle

public String getMessageBundle()
Returns the name of the message bundle to use when translating the property name and other bits.


getMember

public abstract Member getMember()
Returns the underlying member of the property (the field or method that provides the annotations).


getMemberObject

public 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)).


getType

public abstract Class<?> getType()
Returns the property type.


getGenericType

public abstract Type getGenericType()
Returns the generic property type.


getComponentType

public Class<?> getComponentType()
Returns the component type of this (array or collection) type.


getGenericComponentType

public Type getGenericComponentType()
Returns the generic component type of this (array or collection) type.


getArgumentType

public 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).

Returns:
the first argument of the generic class or interface, or null if not found.

getArgumentTypes

public 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).

Returns:
the arguments of the generic class or interface, or null if not found.

getGenericArgumentType

public 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).

Returns:
the first argument of the generic class or interface, or null if not found.

getGenericArgumentTypes

public 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).

Returns:
the arguments of the generic class or interface, or null if not found.

isLegalValue

public boolean isLegalValue(Object value)
Determines whether the supplied value is legal for this property.


getMode

public String getMode()
Returns the mode string. Usually this comes from the property annotation, but derived classes may inherit values from elsewhere.


getUnits

public String getUnits()
Returns the units string.


getMinimum

public double getMinimum()
Returns the minimum value.


getMaximum

public double getMaximum()
Returns the maximum value.


getStep

public double getStep()
Returns the step value.


getScale

public double getScale()
Returns the scale value.


getMinSize

public int getMinSize()
Returns the minimum size.


getMaxSize

public int getMaxSize()
Returns the maximum size;


getAnnotation

public Editable getAnnotation()
Returns a reference to the Editable annotation, which contains simple constraints.


isAnnotationPresent

public boolean isAnnotationPresent(Class<? extends Annotation> clazz)
Determines whether the property has an annotation of the specified class.


getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> clazz)
Returns a reference to the annotation of the specified class, if it exists.


getBoolean

public boolean getBoolean(Object object)
Retrieves the value of the property.


getByte

public byte getByte(Object object)
Retrieves the value of the property.


getChar

public char getChar(Object object)
Retrieves the value of the property.


getDouble

public double getDouble(Object object)
Retrieves the value of the property.


getFloat

public float getFloat(Object object)
Retrieves the value of the property.


getInt

public int getInt(Object object)
Retrieves the value of the property.


getLong

public long getLong(Object object)
Retrieves the value of the property.


getShort

public short getShort(Object object)
Retrieves the value of the property.


get

public abstract Object get(Object object)
Retrieves the value of the property.


setBoolean

public void setBoolean(Object object,
                       boolean value)
Sets the value of the property.


setByte

public void setByte(Object object,
                    byte value)
Sets the value of the property.


setChar

public void setChar(Object object,
                    char value)
Sets the value of the property.


setDouble

public void setDouble(Object object,
                      double value)
Sets the value of the property.


setFloat

public void setFloat(Object object,
                     float value)
Sets the value of the property.


setInt

public void setInt(Object object,
                   int value)
Sets the value of the property.


setLong

public void setLong(Object object,
                    long value)
Sets the value of the property.


setShort

public void setShort(Object object,
                     short value)
Sets the value of the property.


set

public abstract void set(Object object,
                         Object value)
Sets the value of the property.


toString

public String toString()
Overrides:
toString in class DeepObject


Copyright © 2011. All Rights Reserved.