org.simantics.databoard.binding.mutable
Class MutableVariant

java.lang.Object
  extended by org.simantics.databoard.binding.mutable.Variant
      extended by org.simantics.databoard.binding.mutable.MutableVariant
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Variant>

public class MutableVariant
extends Variant
implements java.io.Serializable, java.lang.Cloneable

MutableVariant is a container to a data value of any type. The value and type can be changed. MutableVariant is hash-equals-comparable, even variants of bindings (and types). The hash function and comparison rules are defined in the manual.

Author:
Toni Kalajainen
See Also:
is binding for Variant-class, Serialized Form

Constructor Summary
MutableVariant()
          Constract a variant with a default value of empty record {}
MutableVariant(Binding binding, java.lang.Object value)
           
MutableVariant(Variant v)
           
 
Method Summary
 MutableVariant clone()
           
static MutableVariant ofInstance(java.lang.Object instance)
           
 void readFrom(Binding binding, java.lang.Object newValue)
           
 void setValue(Binding binding, java.lang.Object newValue)
           
 void setValue(Variant v)
          Set value and binding from a variant.
 
Methods inherited from class org.simantics.databoard.binding.mutable.Variant
compareTo, equals, getAccessor, getBinding, getValue, getValue, hashCode, toString, type, valueEquals
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableVariant

public MutableVariant()
Constract a variant with a default value of empty record {}


MutableVariant

public MutableVariant(Variant v)

MutableVariant

public MutableVariant(Binding binding,
                      java.lang.Object value)
Method Detail

ofInstance

public static MutableVariant ofInstance(java.lang.Object instance)

setValue

public void setValue(Variant v)
Set value and binding from a variant. This method takes the references, and does not clone the value.

Parameters:
v - source variant

setValue

public void setValue(Binding binding,
                     java.lang.Object newValue)

readFrom

public void readFrom(Binding binding,
                     java.lang.Object newValue)
              throws BindingException
Throws:
BindingException

clone

public MutableVariant clone()
Overrides:
clone in class Variant