Class AbstractProperty

java.lang.Object
nl.tudelft.simulation.introspection.AbstractProperty
All Implemented Interfaces:
Property
Direct Known Subclasses:
BeanProperty, FieldProperty

public abstract class AbstractProperty extends Object implements Property
A default Property implementation that provides a standard way to handle composite values.

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Since:
1.5
Author:
Peter Jacobs , Alexander Verbraeck, Niels Lang.
  • Constructor Details

    • AbstractProperty

      public AbstractProperty()
  • Method Details

    • setValue

      public void setValue(Object value)
      Basic 'setValue' implementation. It is checked whether this property contains a composite value. If so, the composite value of this property is updated. Composite values are expected to be supplied as a {see java.util.Collection}. If needed, array conversion takes place. If the property is not composite, the value-setting is delegated to the 'setRegularValue' method. Maps cannot be updated at this moment.
      Specified by:
      setValue in interface Property
      Parameters:
      value - Object; The new value of this property.
      See Also:
    • setRegularValue

      protected abstract void setRegularValue(Object value)
      Method used to set a regular (i.e. not-composite) property value.
      Parameters:
      value - Object; the new value
    • getComposedType

      public ComposedTypeEnum getComposedType()
      Returns the collection type of the contained value (i.e. a composite value). The definition whether a value is considered composite depends on the property paradigm used by this Property.
      Specified by:
      getComposedType in interface Property
      Returns:
      the CollectionTypeEnum of this Property.
    • getComponentType

      public Class<?> getComponentType()
      Returns the type of the collection components contained in this Property.
      Specified by:
      getComponentType in interface Property
      Returns:
      The type of the collection components contained in this Property. Returns null when isCollection() returns false, or when the component type could not be determined by this Property.
    • toString

      public String toString()
      Overrides:
      toString in class Object