Class ColumnInfo

  • All Implemented Interfaces:
    ValueInfo

    public class ColumnInfo
    extends DefaultValueInfo
    Contains information about a table column. This includes a description of the values contained in it (as per the ValueInfo interface) as well as additional miscellaneous metadata. The miscellaneous, or auxiliary, metadata takes the form of a list of DescribedValue objects. It is the intention that only one object in this list exists for each value name (as returned by the DescribedValue.getName method. This restriction is not guaranteed to be enforced however.
    Author:
    Mark Taylor (Starlink)
    • Constructor Detail

      • ColumnInfo

        public ColumnInfo​(java.lang.String name)
        Constructs a ColumnInfo object.
        Parameters:
        name - the name of the column
      • ColumnInfo

        public ColumnInfo​(ValueInfo base)
        Constructs a new ColumnInfo based on a ValueInfo object. All attributes are copied from the template to the new object.
        Parameters:
        base - the template ValueInfo
      • ColumnInfo

        public ColumnInfo​(java.lang.String name,
                          java.lang.Class contentClass,
                          java.lang.String description)
        Constructs a new ColumnInfo object with a given name, class and description.
        Parameters:
        name - the name applying to described values
        contentClass - the class of which described values should be instances
        description - a textual description of the described values
      • ColumnInfo

        public ColumnInfo​(ColumnInfo base)
        Constructs a ColumnInfo object which is a copy of an existing one.
        Parameters:
        base - the template ColumnInfo
    • Method Detail

      • getAuxData

        public java.util.List getAuxData()
        Returns a list of auxiliary metadata DescribedValue objects pertaining to this column. This is intended as a repository for metadata which is not defined in the ValueInfo interface.
        Returns:
        a List of DescribedValue items
      • getAuxDatumByName

        public DescribedValue getAuxDatumByName​(java.lang.String name)
        Gets an item of auxiliary metadata by its name.
        Parameters:
        name - the name of an auxiliary metadata item
        Returns:
        a DescribedValue object representing the named auxiliary metadata item for this column, or null if none exists
      • getAuxDatum

        public DescribedValue getAuxDatum​(ValueInfo vinfo)
        Gets an item of auxiliary metadata from its specification. Currently this just calls getAuxDatumByName(vinfo.getName()), but may be revised in future to match on other attributes.
        Parameters:
        vinfo - the data item to match
        Returns:
        a DescribedValue object representing the auxiliary metadata item matching vinfo for this column, or null if none exists
      • getAuxDatumValue

        public java.lang.Object getAuxDatumValue​(ValueInfo vinfo,
                                                 java.lang.Class clazz)
        Gets the value of an item of auxiliary metadata using its specification, requiring a particular return type. This convenience method works like getAuxDatum(uk.ac.starlink.table.ValueInfo) but returns a non-null value only if the named item exists and if its value is an instance of the given type clazz.
        Parameters:
        vinfo - the data item to match
        clazz - required return type
        Returns:
        value of the auxiliary metadata item matching vinfo for this column if it exists and is an instance of clazz or one of its subtypes, otherwise null
      • getAuxDatumValueByName

        public java.lang.Object getAuxDatumValueByName​(java.lang.String name,
                                                       java.lang.Class clazz)
        Gets the value of an item of auxiliary metadata by its name, requiring a particular return type. This convenience method works like getAuxDatumByName(java.lang.String), but returns a non-null value only if the named item exists, and if its value is an instance of the given type clazz.
        Parameters:
        name - the name of an auxiliary metadata item
        clazz - required return type
        Returns:
        value of the auxiliary metadata item matching vinfo for this column if it exists and is an instance of clazz or one of its subtypes, otherwise null
      • setAuxDatum

        public void setAuxDatum​(DescribedValue dval)
        Adds the given DescribedValue to the list of auxiliary metadata for this object. If an item in the metadata list with the same name as the supplied value already exists, it is removed from the list.
        Parameters:
        dval - the new datum to add
      • setAuxData

        public void setAuxData​(java.util.List auxData)
        Sets the list of auxiliary metadata items for this column. All elements of the supplied list should be DescribedValue objects.
        Parameters:
        auxData - a list of DescribedValue objects