java.lang.Object
com.aquima.interactions.expressions.tsl.evaluator.nodes.ForeachObject
All Implemented Interfaces:
ICompoundValue, IConvertable, IPrimitiveValue, ISingleValue, IValue, Serializable, Comparable<Object>

public class ForeachObject extends Object implements ICompoundValue
Wrapper for an instance of a TSL foreach loop. This wrapper is used to add support for sequence numbers.
Since:
6.4
Author:
O. Kerpershoek
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ForeachObject(ICompoundValue compoundValue, int index)
    Constructs the wrapper with the instance and the position in the index.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This method converts the internal value to a boolean primitive.
    int
     
    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 converts the internal value to a date object.
    double
    This method converts the internal value to a double primitive.
    This method returns a deep copy of the value.
    boolean
     
    forType(String typeName, IMultilingualText displayValue)
    This method adds the type and display information to the value, and returns the value with this added information.
    This method returns the data type of the value.
    getDisplayValue(String languageCode, IValueFormatter formatter)
    This method returns a string that can be used as display value for the specified language.
    This method will return the (optional) type name of the value.
    This method returns the internal object of this instance without any conversion.
    This method will return the value of the specified property.
    int
     
    boolean
    instanceOf(String typeName)
    This method returns a boolean indicating if this compound value is of the specified type.
    int
    This method converts the internal value to an integer primitive.
    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.
    long
    This method converts the internal value to a long primitive.
    This method converts the internal value to a String object.
    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 class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ForeachObject

      public ForeachObject(ICompoundValue compoundValue, int index)
      Constructs the wrapper with the instance and the position in the index.
      Parameters:
      compoundValue - The instance object that is wrapped.
      index - The index of the instance.
  • Method Details

    • getValue

      public IValue getValue(String name)
      Description copied from interface: ICompoundValue
      This method will return the value of the specified property.
      Specified by:
      getValue in interface ICompoundValue
      Parameters:
      name - The name of the property whose value is requested.
      Returns:
      The value of the property.
    • getValue

      public Object getValue()
      Description copied from interface: IConvertable
      This method returns the internal object of this instance without any conversion.
      Specified by:
      getValue in interface IConvertable
      Returns:
      The internal Object of this attribute value.
    • contains

      public boolean contains(Object objValue)
      Description copied from interface: IValue
      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.
      Specified by:
      contains in interface IValue
      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.
    • getDataType

      public DataType getDataType()
      Description copied from interface: IValue
      This method returns the data type of the value.
      Specified by:
      getDataType in interface IValue
      Returns:
      The data type of the value.
    • getTypeName

      public String getTypeName()
      Description copied from interface: IPrimitiveValue
      This method will return the (optional) type name of the value. The type name is available when the value belongs to a typed set like a domain or entity. In case the value is part of a domain, the type name will contain the name of the domain the value belongs to.
      Specified by:
      getTypeName in interface IPrimitiveValue
      Returns:
      The type of the value.
    • getDisplayValue

      public String getDisplayValue(String languageCode, IValueFormatter formatter)
      Description copied from interface: IPrimitiveValue
      This method returns a string that can be used as display value for the specified language.
      Specified by:
      getDisplayValue in interface IPrimitiveValue
      Parameters:
      languageCode - the code of the language
      formatter - optional formatter
      Returns:
      A string containing the display value for the specified language.
    • isRangeValue

      public boolean isRangeValue()
      Description copied from interface: IValue
      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.
      Specified by:
      isRangeValue in interface IValue
      Returns:
      boolean indicating if the value represent a range value.
    • isSingleValue

      public boolean isSingleValue()
      Description copied from interface: IValue
      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.
      Specified by:
      isSingleValue in interface IValue
      Returns:
      boolean indicating if the value represent a single value.
    • isUnknown

      public boolean isUnknown()
      Description copied from interface: IValue
      This method returns a boolean indicating if the value is unknown.
      Specified by:
      isUnknown in interface IValue
      Returns:
      boolean indicating if the value is unknown.
    • toListValue

      public IListValue toListValue()
      Description copied from interface: IValue
      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.
      Specified by:
      toListValue in interface IValue
      Returns:
      The same value as list.
    • toRangeValue

      public IRangeValue toRangeValue()
      Description copied from interface: IValue
      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.
      Specified by:
      toRangeValue in interface IValue
      Returns:
      The same value as a range value.
    • toSingleValue

      public ISingleValue toSingleValue()
      Description copied from interface: IValue
      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.
      Specified by:
      toSingleValue in interface IValue
      Returns:
      The same value as single value.
    • booleanValue

      public boolean booleanValue()
      Description copied from interface: IConvertable
      This method converts the internal value to a boolean primitive.
      Specified by:
      booleanValue in interface IConvertable
      Returns:
      Boolean primitive of the internal value.
    • dateValue

      public Date dateValue()
      Description copied from interface: IConvertable
      This method converts the internal value to a date object.
      Specified by:
      dateValue in interface IConvertable
      Returns:
      Date object of the internal value.
    • doubleValue

      public double doubleValue()
      Description copied from interface: IConvertable
      This method converts the internal value to a double primitive.
      Specified by:
      doubleValue in interface IConvertable
      Returns:
      Double primitive of the internal value.
    • integerValue

      public int integerValue()
      Description copied from interface: IConvertable
      This method converts the internal value to an integer primitive.
      Specified by:
      integerValue in interface IConvertable
      Returns:
      Integer primitive of the internal value.
    • longValue

      public long longValue()
      Description copied from interface: IConvertable
      This method converts the internal value to a long primitive.
      Specified by:
      longValue in interface IConvertable
      Returns:
      Long primitive of the internal value.
    • stringValue

      public String stringValue()
      Description copied from interface: IConvertable
      This method converts the internal value to a String object.
      Specified by:
      stringValue in interface IConvertable
      Returns:
      String object of the internal value.
    • compareTo

      public int compareTo(Object o)
      Specified by:
      compareTo in interface Comparable<Object>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • forType

      public IPrimitiveValue forType(String typeName, IMultilingualText displayValue)
      Description copied from interface: IPrimitiveValue
      This method adds the type and display information to the value, and returns the value with this added information. The method will not change the state of the value the method is invoked on, but it will return a copy of the current value with the added information.
      Specified by:
      forType in interface IPrimitiveValue
      Parameters:
      typeName - The type of the value.
      displayValue - Multilingual text containing display values.
      Returns:
      The value with the added information.
    • instanceOf

      public boolean instanceOf(String typeName)
      Description copied from interface: ICompoundValue
      This method returns a boolean indicating if this compound value is of the specified type.
      Specified by:
      instanceOf in interface ICompoundValue
      Parameters:
      typeName - The name of the type against which this compound value should be checked.
      Returns:
      a boolean indicating if this compound value is of the specified type.
    • duplicate

      public IValue duplicate()
      Description copied from interface: IValue
      This method returns a deep copy of the value.
      Specified by:
      duplicate in interface IValue
      Returns:
      A deep clone.