Class Attribute<T>
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.Attribute<T>
-
public class Attribute<T> extends java.lang.ObjectClass used to define dynamic attributes on AttributedObject instances. Note that T cannot be a generic type, due to problems withClass<T>when T is a generic. To work around this problem, simply create an interface that extends the generic type (you are programming to interfaces, right?).
-
-
Field Summary
Fields Modifier and Type Field Description private intattributeIndexprivate static java.util.List<Attribute<?>>attributesprivate java.lang.Class<T>clsprivate TdefaultValueprivate NullaryFunction<T>initializerprivate java.lang.Stringname
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Attribute<?>get(int index)Tget(AttributedObject node)static java.util.Set<Attribute<?>>getAttributes(AttributedObject node)intindex()booleanisSet(AttributedObject node)java.lang.Stringname()private static intnext(Attribute<?> attr)static intnumberOfAttributes()voidset(AttributedObject node, T arg)java.lang.StringtoString()java.lang.Class<?>type()
-
-
-
Field Detail
-
attributes
private static java.util.List<Attribute<?>> attributes
-
name
private java.lang.String name
-
initializer
private NullaryFunction<T> initializer
-
defaultValue
private T defaultValue
-
cls
private java.lang.Class<T> cls
-
attributeIndex
private int attributeIndex
-
-
Constructor Detail
-
Attribute
public Attribute(java.lang.Class<T> cls, java.lang.String name, NullaryFunction<T> initializer)
-
-
Method Detail
-
next
private static int next(Attribute<?> attr)
-
numberOfAttributes
public static int numberOfAttributes()
-
get
public static Attribute<?> get(int index)
-
getAttributes
public static java.util.Set<Attribute<?>> getAttributes(AttributedObject node)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
get
public T get(AttributedObject node)
-
set
public void set(AttributedObject node, T arg)
-
isSet
public boolean isSet(AttributedObject node)
-
name
public java.lang.String name()
-
index
public int index()
-
type
public java.lang.Class<?> type()
-
-