sleep.runtime

Interface ScalarType

public interface ScalarType extends Serializable

This interface makes it possible to create a new scalar type. A scalar type is responsible for being able to convert itself to any type of scalar value.

To store a custom scalar type in a scalar:

 Scalar temp = SleepUtils.getScalar(); // returns an empty scalar.
 temp.setValue(new MyScalarType()); 
 

In the above example MyScalarType is an instance that implements the ScalarType interface.

Method Summary
ScalarTypecopyValue()
create a clone of this scalar's value.
doubledoubleValue()
convert the scalar to a double
intintValue()
convert the scalar to an int
longlongValue()
convert the scalar to a long
ObjectobjectValue()
convert the scalar to an object value *shrug*
StringtoString()
convert the scalar to a string

Method Detail

copyValue

public ScalarType copyValue()
create a clone of this scalar's value. It is important to note that you should return a copy here unless you really want scalars of your scalar type to be passed by reference.

doubleValue

public double doubleValue()
convert the scalar to a double

intValue

public int intValue()
convert the scalar to an int

longValue

public long longValue()
convert the scalar to a long

objectValue

public Object objectValue()
convert the scalar to an object value *shrug*

toString

public String toString()
convert the scalar to a string