Package com.kheops.jmap.metadata
Class Attribute
java.lang.Object
com.kheops.jmap.metadata.LocalizedObject
com.kheops.jmap.metadata.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 Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates whether the attribute is read only -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Attribute instance based on the specified attribute, cloning all properties.Creates an Attribute instance with the specified parameters.Creates an Attribute instance with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a deep copy of the current instance.intCompares the current instance to the specified attribute.booleanOverrides the equals method to compare the attribute names.Returns the statistics of the attribute.Returns the format pattern for numeric and date types.getName()Returns the name of the attribute.getTitle()Gets the title of the attribute.Gets the title of the attribute for a specific locale.intgetType()Gets the type of the attribute.inthashCode()booleanReturns whether this attribute is indexed.booleanReturns true if this attribute supports null values.booleanIf the attribute is read onlyvoidremoveTranslationsOtherThan(Locale[] locales) Removes anyLocalefrom this object that are not in the specifiedlocales.voidSets the statistics of the Attribute.voidsetFormatPattern(String formatPattern) Sets the format pattern for numeric and date types Numeric: DecimalFormat Date: SimpleDateFormatvoidsetIndexed(boolean indexed) Sets if this attribute is indexed of not.voidSets the name of the attribute.voidsetNullable(boolean nullable) Sets if this attribute supports null values.voidsetReadOnly(boolean readOnly) Determines if the attribute is read onlyvoidSets the title of the attribute.voidSets the title of the attribute for the specified Locale.voidsetType(int type) Sets the type of the attribute.toString()Methods inherited from class com.kheops.jmap.metadata.LocalizedObject
getAvailableLocales, getTranslation, isTranslationExists, setTranslation, updateTranslations
-
Field Details
-
readOnly
protected boolean readOnlyIndicates whether the attribute is read only
-
-
Constructor Details
-
Attribute
public Attribute() -
Attribute
Creates an Attribute instance with the specified parameters.- Parameters:
name- the name of the attributetype- the type of the attribute (uses java.sql.Types constants)- See Also:
-
Attribute
Creates an Attribute instance with the specified parameters.- Parameters:
name- the name of the attributetitle- an optional display name for the attributetype- the type of the attribute (uses java.sql.Types constants)- See Also:
-
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
Returns the name of the attribute.- Returns:
- name
-
setName
Sets the name of the attribute.- Parameters:
name- the new name of the attribute
-
getTitle
Gets the title of the attribute.- Returns:
- title.
-
getTitle
Gets the title of the attribute for a specific locale.- Parameters:
locale-- Returns:
- title.
-
setTitle
Sets the title of the attribute.- Parameters:
title- the new given title.
-
setTitle
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
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
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
Overrides the equals method to compare the attribute names. -
hashCode
public int hashCode() -
toString
-
compareTo
Compares the current instance to the specified attribute. The comparison is made using the attribute name, ignoring the case of both attributes.- Specified by:
compareToin interfaceComparable<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
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
Returns the format pattern for numeric and date types.NULLis returned if there is no format pattern configured. Numeric: DecimalFormat Date: SimpleDateFormat- Returns:
-
setFormatPattern
Sets the format pattern for numeric and date types Numeric: DecimalFormat Date: SimpleDateFormat- Parameters:
formatPattern-
-
removeTranslationsOtherThan
Description copied from class:LocalizedObjectRemoves anyLocalefrom this object that are not in the specifiedlocales.locales[0]should be the default language- Overrides:
removeTranslationsOtherThanin classLocalizedObject- Parameters:
locales-
-