Interface PropertyDefinition
- All Superinterfaces:
Attribute,AttributeDefinition,Comparable<PropertyDefinition>,Element,PropertyElement,Serializable
- All Known Implementing Classes:
PropertyDefinitionImpl
@TypeMetadata(name="PropertyDefinition",
description="Defines a property of an entity or another property, including its name, type, cardinality (min/max), regex, readonly/mandatory constraints, and default value.",
version="2.0.0")
@Change(version="2.0.0",description="Removed \'notnull\': a null value means the same as an absent one, and \'mandatory\' means present with a real value. \'min\' and \'max\' are optional, and admit a decimal number when the property is a Double or a Float; \'regexp\' is always present, empty for no pattern.") @Change(version="1.1.0",description="The type comply with [AttributeDefinition](type:AttributeDefinition) which add \'defaultValue\'") @Change(version="1.0.0",description="First Version")
public interface PropertyDefinition
extends PropertyElement, Comparable<PropertyDefinition>, AttributeDefinition
Defines a property of an entity or another property, including its
constraints and metadata.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumDocuments the fixed, schema-level attributes every property field carries in a Type Schema -- a glossary of the schema language itself, not a specific property's actual value (that is whatPropertyDefinition's own getters return). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the PropertyDefinition type.static final StringThe property name for the 'readonly' flag.The system field names, each with the getter the model declares for that field.static final StringThe version of this type definition.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_USER -
Method Summary
Modifier and TypeMethodDescriptionReturns the default value of the attribute.Returns the description of the attribute.getMax()Returns the upper bound of the property value.getMin()Returns the lower bound of the property value.getName()Returns the name of the attribute.Returns the property type of the attribute as a string.Returns the regular expression used to validate the attribute's value.booleanChecks if the attribute is mandatory.booleanChecks if the property is read-only.voidsetReadonly(boolean readonly) Sets whether the property is read-only.Methods inherited from interface org.gcube.informationsystem.base.reference.Attribute
getPropertyTypeName, setDefaultValue, setDescription, setMax, setMin, setName, setPropertyType, setRegexpMethods inherited from interface org.gcube.informationsystem.base.reference.AttributeDefinition
setMandatoryMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Field Details
-
NAME
The name of the PropertyDefinition type.- See Also:
-
VERSION
The version of this type definition.- See Also:
-
SYSTEM_FIELD_GETTERS
The system field names, each with the getter the model declares for that field. A property takes a system field name only to describe that very field, on that getter: any other property with one of these names would share its JSON key with the system field. -
READ_ONLY_PROPERTY
The property name for the 'readonly' flag.- See Also:
-
-
Method Details
-
getName
Returns the name of the attribute. -
getDescription
Returns the description of the attribute.- Specified by:
getDescriptionin interfaceAttribute- Returns:
- The attribute's description.
-
isMandatory
@ISProperty(name="mandatory", readonly=false, mandatory=true, defaultValue="false") boolean isMandatory()Checks if the attribute is mandatory.- Specified by:
isMandatoryin interfaceAttributeDefinition- Returns:
trueif the attribute is mandatory,falseotherwise.
-
isReadonly
@ISProperty(name="readonly", readonly=false, mandatory=true, defaultValue="false") boolean isReadonly()Checks if the property is read-only.- Returns:
trueif the property is read-only,falseotherwise.
-
setReadonly
void setReadonly(boolean readonly) Sets whether the property is read-only.- Parameters:
readonly-trueto make the property read-only.
-
getMax
@ISProperty(name="max", description="The upper bound of the property value: an integer, or a decimal number when the property is a Double or a Float.", type=java.lang.Object.class, readonly=false, mandatory=false) Number getMax()Returns the upper bound of the property value.A decimal number is admitted only when the base type of the property is
DoubleorFloat; for every other base type the bound is an integer. -
getMin
@ISProperty(name="min", description="The lower bound of the property value: an integer, or a decimal number when the property is a Double or a Float.", type=java.lang.Object.class, readonly=false, mandatory=false) Number getMin()Returns the lower bound of the property value.A decimal number is admitted only when the base type of the property is
DoubleorFloat; for every other base type the bound is an integer. -
getRegexp
Returns the regular expression used to validate the attribute's value. -
getPropertyType
Returns the property type of the attribute as a string.- Specified by:
getPropertyTypein interfaceAttribute- Returns:
- The property type.
-
getDefaultValue
Returns the default value of the attribute.- Specified by:
getDefaultValuein interfaceAttribute- Returns:
- The default value.
-