Class PropertyElementImpl
java.lang.Object
org.gcube.informationsystem.base.impl.ElementImpl
org.gcube.informationsystem.base.impl.properties.PropertyElementImpl
- All Implemented Interfaces:
Serializable,Element,PropertyElement,SchemaMixedElement,ModelElement,Property
- Direct Known Subclasses:
LinkedEntityImpl,PropertyImpl,TemplateVariableImpl
The default implementation of the
PropertyElement interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionA map to store additional, non-standard properties.A set of keys that are allowed as additional properties, even if they start with '_' or '@'.protected StringThe expected type of the property's value.The list of supertypes for this property.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllowedAdditionalKey(String allowedAdditionalKey) Adds a key to the set of allowed additional keys.Returns a map of all additional properties not defined in the schema.Retrieves a single additional property by its key.Returns the name of the expected type.Returns the list of supertypes for this element.voidsetAdditionalProperties(Map<String, Object> additionalProperties) Sets the map of additional properties for the element.voidsetAdditionalProperty(String key, Object value) Sets a single additional property.Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Field Details
-
supertypes
The list of supertypes for this property. -
expectedtype
The expected type of the property's value. -
additionalProperties
A map to store additional, non-standard properties. -
allowedAdditionalKeys
A set of keys that are allowed as additional properties, even if they start with '_' or '@'.
-
-
Constructor Details
-
PropertyElementImpl
public PropertyElementImpl()Default constructor. Initializes the additional properties map and the set of allowed keys.
-
-
Method Details
-
getSupertypes
Returns the list of supertypes for this element.This list is included in JSON serialization only if it is not empty.
- Specified by:
getSupertypesin interfaceModelElement- Returns:
- A
Listof supertype names.
-
getExpectedtype
Returns the name of the expected type.This is used during deserialization to indicate the original type when a fallback to a supertype was necessary. It is included in JSON serialization only if it is not empty.
- Specified by:
getExpectedtypein interfaceModelElement- Returns:
- The expected type name.
-
getAdditionalProperties
Returns a map of all additional properties not defined in the schema.- Specified by:
getAdditionalPropertiesin interfaceProperty- Specified by:
getAdditionalPropertiesin interfaceSchemaMixedElement- Returns:
- A
Mapcontaining the additional properties, where the key is the property name and the value is the property value.
-
setAdditionalProperties
Sets the map of additional properties for the element.- Specified by:
setAdditionalPropertiesin interfaceProperty- Specified by:
setAdditionalPropertiesin interfaceSchemaMixedElement- Parameters:
additionalProperties- AMapof additional properties.
-
getAdditionalProperty
Retrieves a single additional property by its key.- Specified by:
getAdditionalPropertyin interfaceProperty- Specified by:
getAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property to retrieve.- Returns:
- The value of the property, or
nullif the key is not found.
-
setAdditionalProperty
Sets a single additional property.- Specified by:
setAdditionalPropertyin interfaceProperty- Specified by:
setAdditionalPropertyin interfaceSchemaMixedElement- Parameters:
key- The name of the additional property.value- The value of the additional property.
-
addAllowedAdditionalKey
Adds a key to the set of allowed additional keys.- Parameters:
allowedAdditionalKey- The key to allow.
-