Class Attribute

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Attribute>
Direct Known Subclasses:
AttributeRestricted, ExternalAttribute, LinkedAttribute, OgrReader.OgrAttribute

public class Attribute extends LocalizedObject implements Serializable, Comparable<Attribute>, Cloneable
This class encapsulates information about an attribute field.
See Also:
  • Field Details

    • readOnly

      protected boolean readOnly
      Indicates whether the attribute is read only
  • Constructor Details

    • Attribute

      public Attribute()
    • Attribute

      public Attribute(String name, int type)
      Creates an Attribute instance with the specified parameters.
      Parameters:
      name - the name of the attribute
      type - the type of the attribute (uses java.sql.Types constants)
      See Also:
    • Attribute

      public Attribute(String name, String title, int type)
      Creates an Attribute instance with the specified parameters.
      Parameters:
      name - the name of the attribute
      title - an optional display name for the attribute
      type - the type of the attribute (uses java.sql.Types constants)
      See Also:
    • Attribute

      public Attribute(Attribute attribute)
      Creates a new Attribute instance based on the specified attribute, cloning all properties.
      Parameters:
      attribute - the attribute to use as reference.
  • Method Details

    • getName

      public String getName()
      Returns the name of the attribute.
      Returns:
      name
    • setName

      public void setName(String name)
      Sets the name of the attribute.
      Parameters:
      name - the new name of the attribute
    • getTitle

      public String getTitle()
      Gets the title of the attribute.
      Returns:
      title.
    • getTitle

      public String getTitle(Locale locale)
      Gets the title of the attribute for a specific locale.
      Parameters:
      locale -
      Returns:
      title.
    • setTitle

      public void setTitle(String title)
      Sets the title of the attribute.
      Parameters:
      title - the new given title.
    • setTitle

      public void setTitle(String title, Locale locale)
      Sets the title of the attribute for the specified Locale.
      Parameters:
      title - the new given title.
      locale - the locale for this title
    • getType

      public int getType()
      Gets the type of the attribute.
      Returns:
      type
      See Also:
    • setType

      public void setType(int type)
      Sets the type of the attribute.
      Parameters:
      type - the specified type
      See Also:
    • isNullable

      public boolean isNullable()
      Returns true if this attribute supports null values.
      Returns:
      whether this attribute supports null values.
    • setNullable

      public void setNullable(boolean nullable)
      Sets if this attribute supports null values.
      Parameters:
      nullable - whether this attribute supports null values.
    • getAttributeStat

      public AttributeStat getAttributeStat()
      Returns the statistics of the attribute. The statistics describe the values for this attribute (min, max, etc.).
      Returns:
      the associated AttributeStat instance
      See Also:
    • setAttributeStat

      public void setAttributeStat(AttributeStat stat)
      Sets the statistics of the Attribute.
      Parameters:
      stat - the corresponding AttributeStat instance
      See Also:
    • setIndexed

      public void setIndexed(boolean indexed)
      Sets if this attribute is indexed of not.
      Parameters:
      indexed - whether this attribute is indexed
    • isIndexed

      public boolean isIndexed()
      Returns whether this attribute is indexed.
      Returns:
      whether this attribute is indexed.
    • equals

      public boolean equals(Object o)
      Overrides the equals method to compare the attribute names.
      Overrides:
      equals in class Object
      Returns:
      true if equal false otherwise.
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Attribute attribute)
      Compares the current instance to the specified attribute. The comparison is made using the attribute name, ignoring the case of both attributes.
      Specified by:
      compareTo in interface Comparable<Attribute>
      Parameters:
      attribute - the attribute to be compared.
      Returns:
      0, if both attributes are equals and a negative integer if the current attribute name if lower than the specified attribute. Otherwise, a positive integer is returned.
    • clone

      public Object clone()
      Returns a deep copy of the current instance.
      Overrides:
      clone in class Object
      Returns:
      a deep copy of the current instance.
    • isReadOnly

      public boolean isReadOnly()
      If the attribute is read only
      Returns:
      true if the attribute is read only
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Determines if the attribute is read only
      Parameters:
      readOnly - if attribute is read only
    • getFormatPattern

      public String getFormatPattern()
      Returns the format pattern for numeric and date types. NULL is returned if there is no format pattern configured. Numeric: DecimalFormat Date: SimpleDateFormat
      Returns:
    • setFormatPattern

      public void setFormatPattern(String formatPattern)
      Sets the format pattern for numeric and date types Numeric: DecimalFormat Date: SimpleDateFormat
      Parameters:
      formatPattern -
    • removeTranslationsOtherThan

      public void removeTranslationsOtherThan(Locale[] locales)
      Description copied from class: LocalizedObject
      Removes any Locale from this object that are not in the specified locales. locales[0] should be the default language
      Overrides:
      removeTranslationsOtherThan in class LocalizedObject
      Parameters:
      locales -