Class PropertyDefinitionImpl
java.lang.Object
org.gcube.informationsystem.types.impl.properties.PropertyDefinitionImpl
- All Implemented Interfaces:
Serializable,Comparable<PropertyDefinition>,Attribute,AttributeDefinition,Element,PropertyElement,PropertyDefinition
The default implementation of the
PropertyDefinition interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gcube.informationsystem.types.reference.properties.PropertyDefinition
PropertyDefinition.PropertyAttribute -
Field Summary
Fields inherited from interface org.gcube.informationsystem.base.reference.Attribute
DEFAULT_VALUE_PROPERTY, DESCRIPTION_PROPERTY, MAX_PROPERTY, MIN_PROPERTY, NAME_PROPERTY, PROPERTY_TYPE_PROPERTY, REGEX_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.AttributeDefinition
MANDATORY_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USERFields inherited from interface org.gcube.informationsystem.types.reference.properties.PropertyDefinition
NAME, READ_ONLY_PROPERTY, VERSION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor.PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) Constructs a new PropertyDefinitionImpl from an annotation and a method. -
Method Summary
Modifier and TypeMethodDescriptionprotected intcompareIntegers(Integer thisInt, Integer otherInt) Compares two integers.intcompareTo(PropertyDefinition other) booleanReturns the default value of the attribute.Returns the description of the attribute.getMax()Returns the maximum allowed value for the attribute.getMin()Returns the minimum allowed value for the attribute.getName()Returns the name of the attribute.Returns the property type of the attribute as a string.Gets the property type name.Returns the regular expression used to validate the attribute's value.Returns the name of the element's type.inthashCode()booleanChecks if the attribute is mandatory.booleanChecks if the property is read-only.voidsetDefaultValue(Object defaultValue) Sets the default value of the attribute.voidsetDescription(String description) Sets the description of the attribute.voidsetMandatory(boolean mandatory) Sets whether the attribute is mandatory.voidSets the maximum allowed value for the attribute.voidSets the minimum allowed value for the attribute.voidSets the name of the attribute.voidsetPropertyType(String type) Sets the property type.voidsetReadonly(boolean readonly) Sets whether the property is read-only.voidSets the regular expression for validating the attribute's value.toString()
-
Constructor Details
-
PropertyDefinitionImpl
protected PropertyDefinitionImpl()Default constructor. -
PropertyDefinitionImpl
Constructs a new PropertyDefinitionImpl from an annotation and a method.- Parameters:
propertyAnnotation- the annotationmethod- the method
-
-
Method Details
-
getName
Returns the name of the attribute.- Specified by:
getNamein interfaceAttribute- Specified by:
getNamein interfacePropertyDefinition- Returns:
- The attribute's name.
-
setName
Sets the name of the attribute. -
getDescription
Returns the description of the attribute.- Specified by:
getDescriptionin interfaceAttribute- Specified by:
getDescriptionin interfacePropertyDefinition- Returns:
- The attribute's description.
-
setDescription
Sets the description of the attribute.- Specified by:
setDescriptionin interfaceAttribute- Parameters:
description- The description to set.
-
isMandatory
public boolean isMandatory()Checks if the attribute is mandatory.- Specified by:
isMandatoryin interfaceAttributeDefinition- Specified by:
isMandatoryin interfacePropertyDefinition- Returns:
trueif the attribute is mandatory,falseotherwise.
-
setMandatory
public void setMandatory(boolean mandatory) Sets whether the attribute is mandatory.- Specified by:
setMandatoryin interfaceAttributeDefinition- Parameters:
mandatory-trueto make the attribute mandatory,falseotherwise.
-
isReadonly
public boolean isReadonly()Checks if the property is read-only.- Specified by:
isReadonlyin interfacePropertyDefinition- Returns:
trueif the property is read-only,falseotherwise.
-
setReadonly
public void setReadonly(boolean readonly) Sets whether the property is read-only.- Specified by:
setReadonlyin interfacePropertyDefinition- Parameters:
readonly-trueto make the property read-only.
-
getMax
Returns the maximum allowed value for the attribute.- Specified by:
getMaxin interfaceAttribute- Specified by:
getMaxin interfacePropertyDefinition- Returns:
- The maximum value, or
nullif not set.
-
setMax
Sets the maximum allowed value for the attribute. -
getMin
Returns the minimum allowed value for the attribute.- Specified by:
getMinin interfaceAttribute- Specified by:
getMinin interfacePropertyDefinition- Returns:
- The minimum value, or
nullif not set.
-
setMin
Sets the minimum allowed value for the attribute. -
getRegexp
Returns the regular expression used to validate the attribute's value.- Specified by:
getRegexpin interfaceAttribute- Specified by:
getRegexpin interfacePropertyDefinition- Returns:
- The regular expression, or
nullif not set.
-
setRegexp
Sets the regular expression for validating the attribute's value. -
getPropertyType
Returns the property type of the attribute as a string.- Specified by:
getPropertyTypein interfaceAttribute- Specified by:
getPropertyTypein interfacePropertyDefinition- Returns:
- The property type.
-
setPropertyType
Sets the property type.- Specified by:
setPropertyTypein interfaceAttribute- Parameters:
type- the type
-
getPropertyTypeName
Gets the property type name.- Specified by:
getPropertyTypeNamein interfaceAttribute- Returns:
- the property type name
-
getDefaultValue
Returns the default value of the attribute.- Specified by:
getDefaultValuein interfaceAttribute- Specified by:
getDefaultValuein interfacePropertyDefinition- Returns:
- The default value.
-
setDefaultValue
Sets the default value of the attribute.- Specified by:
setDefaultValuein interfaceAttribute- Parameters:
defaultValue- The default value to set.
-
toString
-
hashCode
public int hashCode() -
equals
-
compareIntegers
Compares two integers.- Parameters:
thisInt- the first integerotherInt- the second integer- Returns:
- the result of the comparison
-
compareTo
- Specified by:
compareToin interfaceComparable<PropertyDefinition>
-
getTypeName
Returns the name of the element's type. This is typically used for type identification in serialized forms.- Specified by:
getTypeNamein interfaceElement- Returns:
- The type name of the element.
-