Class Attribute<T>
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.Attribute<T>
-
public class Attribute<T> extends java.lang.Object
Class 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 int
attributeIndex
private static java.util.List<Attribute<?>>
attributes
private java.lang.Class<T>
cls
private T
defaultValue
private NullaryFunction<T>
initializer
private java.lang.String
name
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Attribute<?>
get(int index)
T
get(AttributedObject node)
static java.util.Set<Attribute<?>>
getAttributes(AttributedObject node)
int
index()
boolean
isSet(AttributedObject node)
java.lang.String
name()
private static int
next(Attribute<?> attr)
static int
numberOfAttributes()
void
set(AttributedObject node, T arg)
java.lang.String
toString()
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:
toString
in 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()
-
-