Package sleep.runtime
Interface ScalarType
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
DoubleValue,IntValue,LongValue,NullValue,ObjectValue,StringValue
public interface ScalarType extends java.io.SerializableThis 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ScalarTypecopyValue()create a clone of this scalar's value.doubledoubleValue()convert the scalar to a doublejava.lang.ClassgetType()returns the Class type of this ScalarType.intintValue()convert the scalar to an intlonglongValue()convert the scalar to a longjava.lang.ObjectobjectValue()convert the scalar to an object value *shrug*java.lang.StringtoString()convert the scalar to a string
-
-
-
Method Detail
-
copyValue
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.
-
intValue
int intValue()
convert the scalar to an int
-
longValue
long longValue()
convert the scalar to a long
-
doubleValue
double doubleValue()
convert the scalar to a double
-
toString
java.lang.String toString()
convert the scalar to a string- Overrides:
toStringin classjava.lang.Object
-
objectValue
java.lang.Object objectValue()
convert the scalar to an object value *shrug*
-
getType
java.lang.Class getType()
returns the Class type of this ScalarType. Use this instead of getClass to allow other functions to wrap ScalarType's without breaking functionality
-
-