Class BaseStructure

    • Constructor Detail

      • BaseStructure

        public BaseStructure​(String[] fieldNames,
                             Field[] fields)
        Constructor for a structure field.
        Parameters:
        fieldNames - The field names for the subfields
        fields - The array of nodes definitions for the nodes of the structure.
      • BaseStructure

        public BaseStructure​(String id,
                             String[] fieldNames,
                             Field[] fields)
        Constructor for a structure field.
        Parameters:
        id - The identification string for the structure.
        fieldNames - The field names for the subfields
        fields - The array of nodes definitions for the nodes of the structure.
        Throws:
        IllegalArgumentException - if id is null or empty.
    • Method Detail

      • getID

        public String getID()
        Description copied from interface: Field
        Get the identification string.
        Specified by:
        getID in interface Field
        Returns:
        the identification string, can be empty
      • getField

        public Field getField​(String name)
        Description copied from interface: Structure
        Get the Field for the specified fieldName
        Specified by:
        getField in interface Structure
        Parameters:
        name - the name of the field
        Returns:
        the Field that describes the field
      • getFieldIndex

        public int getFieldIndex​(String name)
        Description copied from interface: Structure
        Get the index of the specified field.
        Specified by:
        getFieldIndex in interface Structure
        Parameters:
        name - the name of the field
        Returns:
        the index or -1 if fieldName is not a field in the structure
      • getField

        public Field getField​(int fieldIndex)
        Description copied from interface: Structure
        Get a sub fields by index.
        Specified by:
        getField in interface Structure
        Parameters:
        fieldIndex - the field index
        Returns:
        the field at specified index
      • getField

        public <T extends Field> T getField​(Class<T> c,
                                            String fieldName)
        Description copied from interface: Structure
        Get the Field for the specified fieldName
        Specified by:
        getField in interface Structure
        Type Parameters:
        T - the expected type of the Field of the requested field
        Parameters:
        c - class object modeling the class T of expected type of the requested field
        fieldName - the fieldName
        Returns:
        The Field or null if the field does not exist, or the field is not of type T
      • getField

        public <T extends Field> T getField​(Class<T> c,
                                            int fieldOffset)
        Description copied from interface: Structure
        Get a subfield by index.
        Specified by:
        getField in interface Structure
        Type Parameters:
        T - the expected type of the Field of the requested field
        Parameters:
        c - class object modeling the class T of expected type of the requested field
        fieldOffset - the index
        Returns:
        the Field or null if the field does not exist, or the field is not of type T
      • getFieldNames

        public String[] getFieldNames()
        Description copied from interface: Structure
        Get the array of the subfield names.
        Specified by:
        getFieldNames in interface Structure
        Returns:
        the array
      • getFieldName

        public String getFieldName​(int fieldIndex)
        Description copied from interface: Structure
        Get the name of the subfield by index.
        Specified by:
        getFieldName in interface Structure
        Parameters:
        fieldIndex - the field index
        Returns:
        the name of the field
      • getFields

        public Field[] getFields()
        Description copied from interface: Structure
        Get all the subfields of the structure.
        Specified by:
        getFields in interface Structure
        Returns:
        an array of Field that describes each of the subfields in the structure
      • toString

        public void toString​(StringBuilder buf,
                             int indentLevel)
        Description copied from interface: Field
        Convert to a string
        Specified by:
        toString in interface Field
        Specified by:
        toString in class BaseField
        Parameters:
        buf - buffer for the result
        indentLevel - the indentation level
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object