Class 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 with Class<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 Detail

      • attributes

        private static java.util.List<Attribute<?>> attributes
      • name

        private java.lang.String name
      • 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,
                         T defaultValue)
      • 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)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • name

        public java.lang.String name()
      • index

        public int index()
      • type

        public java.lang.Class<?> type()