Package org.n52.faroe
Class AbstractSettingDefinition<T>
- java.lang.Object
-
- org.n52.faroe.AbstractOrdered
-
- org.n52.faroe.AbstractSettingDefinition<T>
-
- Type Parameters:
T- the type of the value
- All Implemented Interfaces:
Serializable,Comparable<Ordered>,Ordered,SettingDefinition<T>
- Direct Known Subclasses:
BooleanSettingDefinition,ChoiceSettingDefinition,DateTimeSettingDefinition,FileSettingDefinition,IntegerSettingDefinition,MultilingualStringSettingDefinition,NumericSettingDefinition,StringSettingDefinition,UriSettingDefinition
public abstract class AbstractSettingDefinition<T> extends AbstractOrdered implements SettingDefinition<T>, Serializable
Generic implementation ofSettingDefinition.- Since:
- 1.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSettingDefinition(SettingType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)TgetDefaultValue()StringgetDescription()SettingDefinitionGroupgetGroup()StringgetKey()protected StringgetSuborder()StringgetTitle()SettingTypegetType()booleanhasDefaultValue()booleanhasDescription()booleanhasGroup()inthashCode()protected booleanhasStringProperty(String s)booleanhasTitle()booleanisOptional()AbstractSettingDefinition<T>setDefaultValue(T d)Sets the default value of this setting.AbstractSettingDefinition<T>setDescription(String d)Sets the description of this setting definition, which should further describe the purpose of this setting.AbstractSettingDefinition<T>setGroup(SettingDefinitionGroup g)Sets the group of this definition.AbstractSettingDefinition<T>setKey(String k)Sets the unique identifier of this setting definition, which can be referenced by configurable classes.AbstractSettingDefinition<T>setOptional(boolean o)Sets whether this setting is optional or can be null.AbstractSettingDefinition<T>setTitle(String t)Sets the title of this setting definition, which will be presented to the user.(package private) AbstractSettingDefinition<T>setType(SettingType type)StringtoString()-
Methods inherited from class org.n52.faroe.AbstractOrdered
compareTo, getOrder, setOrder
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.n52.faroe.SettingDefinition
getGroup, getOptionalDefaultValue
-
-
-
-
Constructor Detail
-
AbstractSettingDefinition
protected AbstractSettingDefinition(SettingType type)
- Parameters:
type- theSettingTypeof this setting definition
-
-
Method Detail
-
getKey
public String getKey()
- Specified by:
getKeyin interfaceSettingDefinition<T>- Returns:
- the unique key of this definition
-
setKey
public AbstractSettingDefinition<T> setKey(String k)
Description copied from interface:SettingDefinitionSets the unique identifier of this setting definition, which can be referenced by configurable classes.- Specified by:
setKeyin interfaceSettingDefinition<T>- Parameters:
k- the unique key
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceSettingDefinition<T>- Returns:
- the description of this definition
-
setDescription
public AbstractSettingDefinition<T> setDescription(String d)
Description copied from interface:SettingDefinitionSets the description of this setting definition, which should further describe the purpose of this setting. Can contain XHTML markup.- Specified by:
setDescriptionin interfaceSettingDefinition<T>- Parameters:
d- the description
-
hasDescription
public boolean hasDescription()
- Specified by:
hasDescriptionin interfaceSettingDefinition<T>- Returns:
- if this definition has a non empty description
-
getTitle
public String getTitle()
- Specified by:
getTitlein interfaceSettingDefinition<T>- Returns:
- the title of this definition
-
setTitle
public AbstractSettingDefinition<T> setTitle(String t)
Description copied from interface:SettingDefinitionSets the title of this setting definition, which will be presented to the user.- Specified by:
setTitlein interfaceSettingDefinition<T>- Parameters:
t- the title
-
hasTitle
public boolean hasTitle()
- Specified by:
hasTitlein interfaceSettingDefinition<T>- Returns:
- if this definition has a non empty title
-
isOptional
public boolean isOptional()
- Specified by:
isOptionalin interfaceSettingDefinition<T>- Returns:
- wether this setting is optional or required.
-
setOptional
public AbstractSettingDefinition<T> setOptional(boolean o)
Description copied from interface:SettingDefinitionSets whether this setting is optional or can be null. By default all settings are required.- Specified by:
setOptionalin interfaceSettingDefinition<T>- Parameters:
o- if this setting is optional
-
getGroup
public SettingDefinitionGroup getGroup()
- Specified by:
getGroupin interfaceSettingDefinition<T>- Returns:
- the group of this definition
-
setGroup
public AbstractSettingDefinition<T> setGroup(SettingDefinitionGroup g)
Description copied from interface:SettingDefinitionSets the group of this definition. If no group is set, the setting will be moved to a default group.- Specified by:
setGroupin interfaceSettingDefinition<T>- Parameters:
g- the group
-
hasGroup
public boolean hasGroup()
- Specified by:
hasGroupin interfaceSettingDefinition<T>- Returns:
- if this definition has a group
-
getDefaultValue
public T getDefaultValue()
- Specified by:
getDefaultValuein interfaceSettingDefinition<T>- Returns:
- the default value (or null if there is none)
-
setDefaultValue
public AbstractSettingDefinition<T> setDefaultValue(T d)
Description copied from interface:SettingDefinitionSets the default value of this setting. All required settings should have a default setting to allow a smoother integration of new settings in old configurations.- Specified by:
setDefaultValuein interfaceSettingDefinition<T>- Parameters:
d- the default value
-
hasDefaultValue
public boolean hasDefaultValue()
- Specified by:
hasDefaultValuein interfaceSettingDefinition<T>- Returns:
- if this definition has a default value
-
hasStringProperty
protected boolean hasStringProperty(String s)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractOrdered
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractOrdered
-
getType
public SettingType getType()
- Specified by:
getTypein interfaceSettingDefinition<T>- Returns:
- the type of the value of this definition
-
setType
AbstractSettingDefinition<T> setType(SettingType type)
-
getSuborder
protected String getSuborder()
- Specified by:
getSuborderin classAbstractOrdered
-
-