|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.databeans.AbstractDataObject
dsto.dfc.databeans.SimpleDataObject
dsto.dfc.databeans.FancyDataObject
dsto.dfc.databeans.TypeInfo
public class TypeInfo
Defines metadata for a given data object type, acting in a similar role as a Java class. The key difference is that metadata can be attached dynamically to type info, allowing such things as icons, suggested editors, etc to be attached to types.
This object is used in two slightly different ways depending on whether it is metdata for "primitive" (non-IDataObject) or "complex" (IDataObject) instances.
For complex objects, the type
field is a template that
describes the known properties of this type. For each known
property of an instance, the template has a property => TypeInfo
mapping i.e. getValue (property) yeilds the TypeInfo for values of
that property.
For primitive objects, the "type" field is not used, instead the
class of the object is held in valueClass
. If this field
is java.lang.Object, it indicates any value can be present.
TypeRegistry
Field Summary | |
---|---|
static String |
DEFAULT_VALUE
The property name used to store the default value of a given type. |
String |
id
The logical ID of this type. |
IDataObject |
type
A data object that defines the "type" as a mapping of known properties to TypeInfo descriptions. |
Class |
valueClass
Defines the class for instances of this type. |
Fields inherited from class dsto.dfc.databeans.AbstractDataObject |
---|
listeners |
Fields inherited from interface dsto.dfc.databeans.IDataObject |
---|
OVERRIDE, PERSISTENT, PERSISTENT_OVERRIDE, TRANSIENT, TRANSIENT_OVERRIDE |
Constructor Summary | |
---|---|
TypeInfo()
Create a new IDataObject-based type. |
|
TypeInfo(Class valueClass)
Create a new non-IDataObject type. |
|
TypeInfo(int minValue,
int maxValue)
Shortcut create type info for integer values with given max/min values. |
Method Summary | |
---|---|
void |
addPropertyInfo(Object propertyName,
String propertyType)
Add type info for the value of a given property. |
void |
addPropertyInfo(Object propertyName,
TypeInfo propertyType)
Add type info for the value of a given property. |
protected String |
createId()
|
boolean |
equals(Object obj)
|
boolean |
equals(TypeInfo info)
|
TypeInfo |
getPropertyInfo(Object property)
Get type info for values of a given property. |
int |
hashCode()
|
boolean |
isDataObject()
Test if instances of this type are IDataObject-based. |
Methods inherited from class dsto.dfc.databeans.FancyDataObject |
---|
childPropertyChanged, getValue, isTransient, propertyIterator, setValue, shallowClone |
Methods inherited from class dsto.dfc.databeans.SimpleDataObject |
---|
getFieldNames, getTypeInfo, setValue |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_VALUE
public final IDataObject type
TypeInfo
descriptions. This will be null
for non-IDataObject types (see valueClass
).
public final Class valueClass
type
.
public final String id
Constructor Detail |
---|
public TypeInfo()
public TypeInfo(Class valueClass)
valueClass
- The class that instances of this type conform to.public TypeInfo(int minValue, int maxValue)
minValue
- The min value: mapped to minValue custom property
on the type info.maxValue
- The max value: mapped to maxValue custom property
on the type info.Method Detail |
---|
protected String createId()
public boolean isDataObject()
public void addPropertyInfo(Object propertyName, TypeInfo propertyType)
propertyName
- The property name.propertyType
- The type info describing values of the property.addPropertyInfo(Object, String)
,
getPropertyInfo(Object)
public void addPropertyInfo(Object propertyName, String propertyType)
propertyName
- The property name.propertyType
- The logical name of the type info.
TypeRegistry.getTypeInfo(String)
is used to
resolve this to the registered TypeInfo.
IllegalArgumentException
- if propertyType is not a
registered type info.addPropertyInfo(Object, TypeInfo)
,
getPropertyInfo(Object)
public TypeInfo getPropertyInfo(Object property)
property
- The property name,
IllegalArgumentException
- if this is not type info for a
IDataBean-based type.addPropertyInfo(Object, TypeInfo)
public boolean equals(Object obj)
equals
in class Object
public boolean equals(TypeInfo info)
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |