Class TemplateLabel

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private KeyBuilder builder
      This is the builder that is used to generate label keys.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TemplateLabel()
      Constructor for the TemplateLabel is used to create a template for other labels.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Type getDependent()
      This is used to acquire the dependent class for this label.
      java.lang.String getEntry()
      This is typically used to acquire the entry value as acquired from the annotation.
      java.lang.Object getKey()
      This is the key used to represent this label.
      Label getLabel​(java.lang.Class type)
      This is used to acquire the Label that the type provided is represented by.
      java.lang.String[] getNames()
      This returns a Collection of element names.
      java.lang.String[] getPaths()
      This returns a Collection of element paths.
      Type getType​(java.lang.Class type)
      This is used to acquire the Type that the type provided is represented by.
      boolean isAttribute()
      This method is used to determine if the label represents an attribute.
      boolean isCollection()
      This is used to determine if the label is a collection.
      boolean isInline()
      This is used to determine whether the label represents an inline XML entity.
      boolean isText()
      This is used to determine if the label represents text.
      boolean isTextList()
      This is used to determine if an annotated list is a text list.
      boolean isUnion()
      This is used to determine if this label is a union.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • builder

        private final KeyBuilder builder
        This is the builder that is used to generate label keys.
    • Constructor Detail

      • TemplateLabel

        protected TemplateLabel()
        Constructor for the TemplateLabel is used to create a template for other labels. If any of the method implementations are not as required or they should be overridden by the subclass.
    • Method Detail

      • getType

        public Type getType​(java.lang.Class type)
                     throws java.lang.Exception
        This is used to acquire the Type that the type provided is represented by. Typically this will return the field or method represented by the label. However, in the case of unions this will provide an override type.
        Specified by:
        getType in interface Label
        Parameters:
        type - this is the class to acquire the type for
        Returns:
        this returns the type represented by this class
        Throws:
        java.lang.Exception
      • getLabel

        public Label getLabel​(java.lang.Class type)
                       throws java.lang.Exception
        This is used to acquire the Label that the type provided is represented by. Typically this will return the same instance. However, in the case of unions this will look for an individual label to match the type provided.
        Specified by:
        getLabel in interface Label
        Parameters:
        type - this is the type to acquire the label for
        Returns:
        this returns the label represented by this type
        Throws:
        java.lang.Exception
      • getNames

        public java.lang.String[] getNames()
                                    throws java.lang.Exception
        This returns a Collection of element names. This will typically contain both the name and path of the label. However, if this is a union it can contain many names and paths. This method should never return null.
        Specified by:
        getNames in interface Label
        Returns:
        this returns the names of each of the elements
        Throws:
        java.lang.Exception
      • getPaths

        public java.lang.String[] getPaths()
                                    throws java.lang.Exception
        This returns a Collection of element paths. This will typically contain only the path of the label, which is composed using the Path annotation and the name of the label. However, if this is a union it can contain many paths. This method should never return null.
        Specified by:
        getPaths in interface Label
        Returns:
        this returns the names of each of the elements
        Throws:
        java.lang.Exception
      • getKey

        public java.lang.Object getKey()
                                throws java.lang.Exception
        This is the key used to represent this label. The key is used to store the parameter in hash containers. Typically the key is generated from the paths associated with the label.
        Specified by:
        getKey in interface Label
        Returns:
        this is the key used to represent the label
        Throws:
        java.lang.Exception
      • getEntry

        public java.lang.String getEntry()
                                  throws java.lang.Exception
        This is typically used to acquire the entry value as acquired from the annotation. However given that the annotation this represents does not have a entry attribute this will always provide a null value for the entry string.
        Specified by:
        getEntry in interface Label
        Returns:
        this will always return null for the entry value
        Throws:
        java.lang.Exception
      • getDependent

        public Type getDependent()
                          throws java.lang.Exception
        This is used to acquire the dependent class for this label. This returns null as there are no dependents to the element annotation as it can only hold primitives with no dependents.
        Specified by:
        getDependent in interface Label
        Returns:
        this is used to return the dependent type of null
        Throws:
        java.lang.Exception
      • isAttribute

        public boolean isAttribute()
        This method is used to determine if the label represents an attribute. This is used to style the name so that elements are styled as elements and attributes are styled as required.
        Specified by:
        isAttribute in interface Label
        Returns:
        this is used to determine if this is an attribute
      • isCollection

        public boolean isCollection()
        This is used to determine if the label is a collection. If the label represents a collection then any original assignment to the field or method can be written to without the need to create a new collection. This allows obscure collections to be used and also allows initial entries to be maintained.
        Specified by:
        isCollection in interface Label
        Returns:
        true if the label represents a collection value
      • isInline

        public boolean isInline()
        This is used to determine whether the label represents an inline XML entity. The ElementList annotation and the Text annotation represent inline items. This means that they contain no containing element and so can not specify overrides or special attributes.
        Specified by:
        isInline in interface Label
        Returns:
        this returns true if the annotation is inline
      • isText

        public boolean isText()
        This is used to determine if the label represents text. If a label represents text it typically does not have a name, instead the empty string represents the name. Also text labels can not exist with other text labels, or elements.
        Specified by:
        isText in interface Label
        Returns:
        this returns true if this label represents text
      • isTextList

        public boolean isTextList()
        This is used to determine if an annotated list is a text list. A text list is a list of elements that also accepts free text. Typically this will be an element list union that will allow unstructured XML such as XHTML to be parsed.
        Specified by:
        isTextList in interface Label
        Returns:
        returns true if the label represents a text list
      • isUnion

        public boolean isUnion()
        This is used to determine if this label is a union. If this is true then this label represents a number of labels and is simply a wrapper for these labels.
        Specified by:
        isUnion in interface Label
        Returns:
        this returns true if the label represents a union