org.glassfish.pfl.dynamic.codegen.impl
Class Attribute<T>

java.lang.Object
  extended by org.glassfish.pfl.dynamic.codegen.impl.Attribute<T>

public class Attribute<T>
extends Object

Class used to define dynamic attributes on AttributedObject instances. Note that T cannot be a generic type, due to problems with Class 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?).


Constructor Summary
Attribute(Class<T> cls, String name, org.glassfish.pfl.basic.func.NullaryFunction<T> initializer)
           
Attribute(Class<T> cls, String name, T defaultValue)
           
 
Method Summary
 T get(AttributedObject node)
           
static Attribute<?> get(int index)
           
static Set<Attribute<?>> getAttributes(AttributedObject node)
           
 int index()
           
 boolean isSet(AttributedObject node)
           
 String name()
           
static int numberOfAttributes()
           
 void set(AttributedObject node, T arg)
           
 String toString()
           
 Class<?> type()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute(Class<T> cls,
                 String name,
                 T defaultValue)

Attribute

public Attribute(Class<T> cls,
                 String name,
                 org.glassfish.pfl.basic.func.NullaryFunction<T> initializer)
Method Detail

numberOfAttributes

public static int numberOfAttributes()

get

public static Attribute<?> get(int index)

getAttributes

public static Set<Attribute<?>> getAttributes(AttributedObject node)

toString

public String toString()
Overrides:
toString in class Object

get

public T get(AttributedObject node)

set

public void set(AttributedObject node,
                T arg)

isSet

public boolean isSet(AttributedObject node)

name

public String name()

index

public int index()

type

public Class<?> type()


Copyright © 2013 Oracle. All Rights Reserved.