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

public class PropertyElementImpl extends ElementImpl implements Property
The default implementation of the PropertyElement interface.
Author:
Luca Frosini (ISTI - CNR)
See Also:
  • Field Details

    • supertypes

      protected List<String> supertypes
      The list of supertypes for this property.
    • expectedtype

      protected String expectedtype
      The expected type of the property's value.
    • additionalProperties

      protected Map<String,Object> additionalProperties
      A map to store additional, non-standard properties.
    • allowedAdditionalKeys

      protected final Set<String> 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

      public List<String> getSupertypes()
      Returns the list of supertypes for this element.

      This list is included in JSON serialization only if it is not empty.

      Specified by:
      getSupertypes in interface ModelElement
      Returns:
      A List of supertype names.
    • getExpectedtype

      public String 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:
      getExpectedtype in interface ModelElement
      Returns:
      The expected type name.
    • getAdditionalProperties

      public Map<String,Object> getAdditionalProperties()
      Returns a map of all additional properties not defined in the schema.
      Specified by:
      getAdditionalProperties in interface Property
      Specified by:
      getAdditionalProperties in interface SchemaMixedElement
      Returns:
      A Map containing the additional properties, where the key is the property name and the value is the property value.
    • setAdditionalProperties

      public void setAdditionalProperties(Map<String,Object> additionalProperties)
      Sets the map of additional properties for the element.
      Specified by:
      setAdditionalProperties in interface Property
      Specified by:
      setAdditionalProperties in interface SchemaMixedElement
      Parameters:
      additionalProperties - A Map of additional properties.
    • getAdditionalProperty

      public Object getAdditionalProperty(String key)
      Retrieves a single additional property by its key.
      Specified by:
      getAdditionalProperty in interface Property
      Specified by:
      getAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property to retrieve.
      Returns:
      The value of the property, or null if the key is not found.
    • setAdditionalProperty

      public void setAdditionalProperty(String key, Object value)
      Sets a single additional property.
      Specified by:
      setAdditionalProperty in interface Property
      Specified by:
      setAdditionalProperty in interface SchemaMixedElement
      Parameters:
      key - The name of the additional property.
      value - The value of the additional property.
    • addAllowedAdditionalKey

      public void addAllowedAdditionalKey(String allowedAdditionalKey)
      Adds a key to the set of allowed additional keys.
      Parameters:
      allowedAdditionalKey - The key to allow.