public class Attribute extends LocalizedObject implements java.io.Serializable, java.lang.Comparable<Attribute>, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
readOnly
Indicates whether the attribute is read only
|
| Constructor and Description |
|---|
Attribute() |
Attribute(Attribute attribute)
Creates a new Attribute instance based on the specified attribute, cloning all properties.
|
Attribute(java.lang.String name,
int type)
Creates an Attribute instance with the specified parameters.
|
Attribute(java.lang.String name,
java.lang.String title,
int type)
Creates an Attribute instance with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Returns a deep copy of the current instance.
|
int |
compareTo(Attribute attribute)
Compares the current instance to the specified attribute.
|
boolean |
equals(java.lang.Object o)
Overrides the equals method to compare the attribute names.
|
AttributeStat |
getAttributeStat()
Returns the statistics of the attribute.
|
java.lang.String |
getFormatPattern()
Returns the format pattern for numeric and date types.
|
java.lang.String |
getName()
Returns the name of the attribute.
|
java.lang.String |
getTitle()
Gets the title of the attribute.
|
java.lang.String |
getTitle(java.util.Locale locale)
Gets the title of the attribute for a specific locale.
|
int |
getType()
Gets the type of the attribute.
|
int |
hashCode() |
boolean |
isIndexed()
Returns whether or not this attribute is indexed.
|
boolean |
isNullable()
Returns true if this attribute supports null values.
|
boolean |
isReadOnly()
If the attribute is read only
|
void |
removeTranslationsOtherThan(java.util.Locale[] locales)
Removes any
Locale from this object that are not in the specified locales. |
void |
setAttributeStat(AttributeStat stat)
Sets the statistics of the Attribute.
|
void |
setFormatPattern(java.lang.String formatPattern)
Sets the format pattern for numeric and date types
Numeric: DecimalFormat
Date: SimpleDateFormat
|
void |
setIndexed(boolean indexed)
Sets if this attribute is indexed of not.
|
void |
setName(java.lang.String name)
Sets the name of the attribute.
|
void |
setNullable(boolean nullable)
Sets if this attribute supports null values.
|
void |
setReadOnly(boolean readOnly)
Determines if the attribute is read only
|
void |
setTitle(java.lang.String title)
Sets the title of the attribute.
|
void |
setTitle(java.lang.String title,
java.util.Locale locale)
Sets the title of the attribute for the specified Locale.
|
void |
setType(int type)
Sets the type of the attribute.
|
java.lang.String |
toString() |
getAvailableLocales, getTranslation, isTranslationExists, setTranslation, updateTranslationspublic Attribute()
public Attribute(java.lang.String name,
int type)
name - the name of the attributetype - the type of the attribute (uses java.sql.Types constants)Typespublic Attribute(java.lang.String name,
java.lang.String title,
int type)
name - the name of the attributetitle - an optional display name for the attributetype - the type of the attribute (uses java.sql.Types constants)Typespublic Attribute(Attribute attribute)
attribute - the attribute to use as reference.public java.lang.String getName()
public void setName(java.lang.String name)
name - the new name of the attributepublic java.lang.String getTitle()
public java.lang.String getTitle(java.util.Locale locale)
locale - public void setTitle(java.lang.String title)
title - the new given title.public void setTitle(java.lang.String title,
java.util.Locale locale)
title - the new given title.locale - the locale for this titlepublic int getType()
Typespublic void setType(int type)
type - the specified typeTypespublic boolean isNullable()
public void setNullable(boolean nullable)
nullable - whether or not this attribute supports null values.public AttributeStat getAttributeStat()
AttributeStatpublic void setAttributeStat(AttributeStat stat)
stat - the corresponding AttributeStat instanceAttributeStatpublic void setIndexed(boolean indexed)
indexed - whether or not this attribute is indexedpublic boolean isIndexed()
public boolean equals(java.lang.Object o)
equals in class java.lang.ObjectObject.equals(Object o)public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Attribute attribute)
compareTo in interface java.lang.Comparable<Attribute>attribute - the attribute to be compared.public java.lang.Object clone()
clone in class java.lang.Objectpublic boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly - if attribute is read onlypublic java.lang.String getFormatPattern()
NULL is returned if there is no format pattern configured.
Numeric: DecimalFormat
Date: SimpleDateFormatpublic void setFormatPattern(java.lang.String formatPattern)
formatPattern - public void removeTranslationsOtherThan(java.util.Locale[] locales)
LocalizedObjectLocale from this object that are not in the specified locales.
locales[0] should be the default languageremoveTranslationsOtherThan in class LocalizedObject