Class TypedValue<T>

java.lang.Object
com.evolveum.midpoint.schema.expression.TypedValue<T>
All Implemented Interfaces:
ShortDumpable

public class TypedValue<T> extends Object implements ShortDumpable
Value and definition pair. E.g. used in expression variable maps. We need to have explicit type here. It may happen that there will be variables without any value. But we need to know the type of the variable to compile the scripts properly. The definition, typeClass and the T parameter of this class refer to the type of the value as it should appear in the expression. The actual value may be different when TypedValue is created. The value may get converted as it is passing down the stack. E.g. if we want script variable to contain a user, the type should be declared as UserType, not as object reference - even though the value is object reference when the TypedValue is created. But the reference is resolved down the way to place user in the value.
Author:
Radovan Semancik
  • Constructor Details

    • TypedValue

      public TypedValue()
    • TypedValue

      public TypedValue(Item<?,?> prismItem)
    • TypedValue

      public TypedValue(Object value, ItemDefinition<?> definition)
    • TypedValue

      public TypedValue(Object value, Class<T> typeClass)
    • TypedValue

      public TypedValue(Object value, ItemDefinition<?> definition, Class<T> typeClass)
  • Method Details

    • of

      @Experimental public static TypedValue<?> of(@NotNull @NotNull Collection<? extends PrismValue> prismValues, @Nullable @Nullable QName typeName)
      Creates a TypedValue with a collection of real values. Simple implementation (for now): . assumes the values have the same class; . does NOT unwrap the values into "real values", using them wrapped. (Moved here from `report-impl` module, can be improved later, if needed.)
      Parameters:
      typeName - Name of the type, if known
    • of

      @Experimental public static TypedValue<?> of(@Nullable @Nullable Object value, @NotNull @NotNull Class<?> defaultClass)
    • getValue

      public Object getValue()
    • setValue

      public void setValue(Object value)
    • getDefinition

      public <D extends ItemDefinition> D getDefinition()
    • setDefinition

      public void setDefinition(ItemDefinition<?> definition)
    • getTypeClass

      public Class<T> getTypeClass()
    • setTypeClass

      public void setTypeClass(Class<T> typeClass)
    • canDetermineType

      public boolean canDetermineType()
    • determineClass

      public Class<T> determineClass() throws SchemaException
      Throws:
      SchemaException
    • createTransformed

      public TypedValue<T> createTransformed(Object newValue)
      Returns new TypedValue that has a new (transformed) value, but has the same definition.
    • shallowClone

      public TypedValue<T> shallowClone()
      Returns the shallow clone of the original object. Value nor definition is copied, NOT cloned.
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • shortDump

      public void shortDump(StringBuilder sb)
      Description copied from interface: ShortDumpable
      Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.
      Specified by:
      shortDump in interface ShortDumpable
      Parameters:
      sb - StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.