Interface IValue

All Superinterfaces:
IConvertable, Serializable
All Known Subinterfaces:
ICompoundValue, IDomain, IDomainDefinition, IListValue, IPrimitiveValue, IRangeValue, ISingleValue
All Known Implementing Classes:
AbstractValue, AnyValue, AttributeBooleanValue, AttributeCurrency, AttributeDateTimeValue, AttributeDateValue, AttributeEntityValue, AttributeInfiniteValue, AttributeIntegerValue, AttributeListValue, AttributeNumberValue, AttributePercentage, AttributeRangeValue, AttributeStringValue, BinaryValue, BooleanValue, Currency, DateTimeValue, DateValue, Domain, DomainDefinition, DomainValues, EntityContextDelegate, EntityValue, ForeachObject, InfiniteValue, InstanceReferrer, IntegerValue, ListValue, NumberValue, Percentage, RangeValue, StringValue, ValueReference

public interface IValue extends Serializable, IConvertable
The value interface provides the basic methods that all value objects should implement. This interface also allows for type safe conversion between the various value objects.
Since:
5.0
Author:
O. Kerpershoek, F. v.d. Meer
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Object objValue)
    This method returns a boolean indicating if the object passed to this method is entirely part of this value.
    This method returns a deep copy of the value.
    This method returns the data type of the value.
    boolean
    This method returns a boolean indicating if this value may safely be converted to a range value by using the toRangeValue method.
    boolean
    This method returns a boolean indicating if this value may safely be converted to a single value by using the toSingleValue method.
    boolean
    This method returns a boolean indicating if the value is unknown.
    This method will convert the current value to a list value.
    This method will attempt to convert the value to a range value.
    This method will attempt to convert the value to a single value.

    Methods inherited from interface com.aquima.interactions.foundation.convert.IConvertable

    booleanValue, dateValue, doubleValue, getValue, integerValue, longValue, stringValue
  • Method Details

    • getDataType

      DataType getDataType()
      This method returns the data type of the value.
      Returns:
      The data type of the value.
    • contains

      boolean contains(Object objValue)
      This method returns a boolean indicating if the object passed to this method is entirely part of this value. This method will thus also return true when the object passed is equal to this value, but the method will return false when only part (or none) of the object is represented by this value. Note that for value types that are singular in nature (for instance, implementations of ISingleValue) the operation of this method is limited to an equality check.
      Parameters:
      objValue - Object for which should be checked if it is entirely part of this value.
      Returns:
      boolean indicating if the object passed is entirely part of this value.
    • isUnknown

      boolean isUnknown()
      This method returns a boolean indicating if the value is unknown.
      Returns:
      boolean indicating if the value is unknown.
    • isSingleValue

      boolean isSingleValue()
      This method returns a boolean indicating if this value may safely be converted to a single value by using the toSingleValue method. Objects that are already a single value will always return true, but ranges and list values may return true when they only contain a single value.
      Note: This method returns true when the value is convertible, it does not mean that the value can safely be casted to the ISingleValue interface.
      Returns:
      boolean indicating if the value represent a single value.
    • isRangeValue

      boolean isRangeValue()
      This method returns a boolean indicating if this value may safely be converted to a range value by using the toRangeValue method. Objects that are already a range or single value will always return true, but list values may return true when they only contain a single value.
      Note: This method returns true when the value is convertable, it does not mean that the value can safely be casted to the IRangeValue interface.
      Returns:
      boolean indicating if the value represent a range value.
    • toSingleValue

      ISingleValue toSingleValue()
      This method will attempt to convert the value to a single value. The conversion might fail and raise an exception when the value this method is called on is either a range or a list value. The method isSingleValue can be used to determine if this value can safely be converted to a single value. When the value this method is called on already implements the ISingleValue interface, the implementation may return the same value.
      Returns:
      The same value as single value.
      Throws:
      ConversionException - This exception is raised when the conversion to single value was not possible.
    • toRangeValue

      IRangeValue toRangeValue()
      This method will attempt to convert the value to a range value. The conversion might fail and raise an exception when the value this method is called on is either a list value. The method isRangeValue can be used to determine if this value can safely be converted to a range value. When the value this method is called on already implements the IRangeValue interface, the implementation may return the same value.
      Returns:
      The same value as a range value.
      Throws:
      ConversionException - This exception is raised when the conversion to range value was not possible.
    • toListValue

      IListValue toListValue()
      This method will convert the current value to a list value. This type of conversion is always possible for all IValue implementations. Values of type ISingleValue or IRangeValue will result in a list value containing the primitive value (list of size 1). When the value this method is called on already implements the IListValue interface, the implementation may return the same value.
      Returns:
      The same value as list.
    • duplicate

      IValue duplicate()
      This method returns a deep copy of the value.
      Returns:
      A deep clone.