Class 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 Detail

      • TypedValue

        public TypedValue()
      • TypedValue

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

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

      • 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()
      • 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
      • 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.
      • setPrismContext

        public void setPrismContext​(PrismContext prismContext)