|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.scene.data.AttributeEntityUtility
public class AttributeEntityUtility
This class handles a whole set of Attributes, that belong together somehow. A
typical application is i.e. a Texture object, that consists of many
attributes, that should be set and get from an appearance as one entity.
Define the entity by a an interface that consists of set/get method pairs -
all these attributes will be handled by the Reader/Writer proxy.
Use this interface either as a Writer on an Appearance or a set of
Appearances:
And use it to read the values from an EffectiveAppearance:
Appearance app = new Appearance();
MyEntityInterface mif = (MyEntityInterface) AttributeEntityFactory
.createAttributeEntity(MyEntityInterface.class, "myEntityName", app);
mif.setAttribute1(value1);
mif.setAttribute2(value2);
EffectiveAppearance ea = ...
MyEntityInterface mif = (MyEntityInterface) AttributeEntityFactory.createAttributeEntity(MyEntityInterface.class, "myEntityName", ea);
value1 = mif.getAttribute1();
value2 = mif.getAttribute2();
Note: Instances that act on Appearance
s can call set- and
get-Methods, instances acting on EffectiveAppearance
s can ONLY use
get-Methods.
The given prefix is used as a name prefix for the single attributes. i.e. in the above example the attribute "attribute1" is stored in the Appearance(s) as setAttribute("myEntityName:attribute1"); To read the values again one needs to use the same prefix as used while writing.
Method Summary | |
---|---|
static AttributeEntity |
createAttributeEntity(Class clazz,
String prefix,
Appearance a,
boolean readDefaults)
Create an implementation of the AttributeEntity for reading from
and/or writing to an Appearance - writes tag to the appearance. |
static AttributeEntity |
createAttributeEntity(Class clazz,
String prefix,
EffectiveAppearance ea)
Create an implementation of the AttributeEntity for reading from an
EffectiveAppearance . |
static AttributeEntity |
getAttributeEntity(Class clazz,
String prefix,
Appearance a,
boolean readDefaults)
Create an implementation of the AttributeEntity for reading from
and/or writing to an Appearance - this does not tag the appearance. |
static boolean |
hasAttributeEntity(Class clazz,
String prefix,
Appearance a)
|
static boolean |
hasAttributeEntity(Class clazz,
String prefix,
EffectiveAppearance eap)
returns true if the appearance is tagged with the given class or if 1. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static AttributeEntity createAttributeEntity(Class clazz, String prefix, Appearance a, boolean readDefaults)
AttributeEntity
for reading from
and/or writing to an Appearance
- writes tag to the appearance.
public static AttributeEntity getAttributeEntity(Class clazz, String prefix, Appearance a, boolean readDefaults)
AttributeEntity
for reading from
and/or writing to an Appearance
- this does not tag the appearance.
public static AttributeEntity createAttributeEntity(Class clazz, String prefix, EffectiveAppearance ea)
AttributeEntity
for reading from an
EffectiveAppearance
.
public static boolean hasAttributeEntity(Class clazz, String prefix, EffectiveAppearance eap)
clazz
- prefix
- eap
-
public static boolean hasAttributeEntity(Class clazz, String prefix, Appearance a)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |