Class Attribute<T>

    • Method Detail

      • attr

        public static final <T> IAttribute<T> attr​(String identifier,
                                                   String name,
                                                   String description,
                                                   ContentType<T> contentType)
        Obtain an attribute.
        Type Parameters:
        T - attribute value type
        Parameters:
        identifier - attribute id
        name - attribute name
        description - attribute description
        contentType - content type of the attribute values
        Returns:
        an attribute
      • attr

        public static final <T> IAttribute<T> attr​(String identifier,
                                                   String name,
                                                   ContentType<T> contentType)
        Obtain an attribute.
        Type Parameters:
        T - attribute value type
        Parameters:
        identifier - attribute id
        name - attribute name
        contentType - content type of the attribute values
        Returns:
        an attribute
      • canonicalize

        public static <T> IAttribute<T> canonicalize​(Attribute<T> key)
        Set key as the canonical (and only allowed) attribute for its equivalence class.
        Type Parameters:
        T - attribute value type
        Parameters:
        key - attribute to canonicalize
        Returns:
        canonicalized attribute
        Throws:
        IllegalStateException - if an equivalent attribute has already been canonicalized
      • customAccessor

        public <U> IMemberAccessor<V,​U> customAccessor​(IType<U> type)
        Override to construct deriving accessors. This will only be called when the type does not directly provide the attribute itself.
        Type Parameters:
        U - input type class
        Parameters:
        type - type to create accessor for
        Returns:
        an accessor that works for the specified type or null if it can't be created
      • getContentType

        public ContentType<T> getContentType()
        Description copied from interface: IAccessorKey
        The content type of this attribute. The type can be an opaque (or leaf) type in which case its instances can be of any class (but typically restricted according to the type). It can also be a structured type which has attributes (fields) of its own, in which case its instances currently must implement IItem.
        Specified by:
        getContentType in interface IAccessorKey<T>
        Returns:
        the content type of this attribute
      • getIdentifier

        public String getIdentifier()
        Description copied from interface: IAccessorKey
        A identifier is a text string identifying the attribute. It must never be localized and it should only contain characters that are safe to use in various configuration files, e.g. as XML tags. (Analogous to Field.getName().)
        Specified by:
        getIdentifier in interface IAccessorKey<T>
        Returns:
        the attribute identifier
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object