org.snapscript.core.Transient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.core;
public class Transient extends Value {
private final Object object;
private final Type type;
public Transient(Object object) {
this(object, null);
}
public Transient(Object object, Type type) {
this.object = object;
this.type = type;
}
@Override
public Type getConstraint(){
return type;
}
@Override
public T getValue(){
return (T)object;
}
@Override
public void setValue(Object value){
throw new InternalStateException("Illegal modification of transient");
}
@Override
public String toString() {
return String.valueOf(object);
}
}