public interface SerializerConstantPool
PostOrderDeserializer
, PostOrderSerializer
and underlying constant pool
implementation. A constant pool stores a value and returns an identifying index, with which the
object can later be returned from the pool again. All methods of this class are optional and may
throw a UnsupportedOperationException
.Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getClass(int cpi)
Returns the
Class instance to the given constant pool index. |
double |
getDouble(int cpi)
Returns the stored double value to the given constant pool index from the constant pool.
|
float |
getFloat(int cpi)
Returns the stored float value to the given constant pool index from the constant pool.
|
int |
getInt(int cpi)
Returns the stored int value to the given constant pool index from the constant pool.
|
long |
getLong(int cpi)
Returns the stored long value to the given constant pool index from the constant pool.
|
java.lang.Object |
getObject(java.lang.Class<?> clazz,
int cpi)
Stores a value in the constant pool that is not a java native type, a java native-wrapper
class or a
Class instance. |
int |
putClass(java.lang.Class<?> value)
Stores a Class instance in the constant pool and returns the constant pool index.
|
int |
putDouble(double value)
Stores a double value in the constant pool and returns the constant pool index.
|
int |
putFloat(float value)
Stores a float value in the constant pool and returns the constant pool index.
|
int |
putInt(int value)
Stores an int value in the constant pool and returns the constant pool index.
|
int |
putLong(long value)
Stores a long value in the constant pool and returns the constant pool index.
|
int |
putObject(java.lang.Class<?> clazz,
java.lang.Object value)
Returns the constant pool index of a value that is not a java native type, a java
native-wrapper class or a
Class instance. |
int putObject(java.lang.Class<?> clazz, java.lang.Object value) throws UnsupportedConstantPoolTypeException
Class
instance. The implementor should support all
additional types that are necessary to serialize a truffle AST for a specific truffle
implementation. If a type is not supported by this constant pool implementation a
UnsupportedConstantPoolTypeException
should be thrown.clazz
- the Class
of the valuevalue
- the value to be stored. Must be at least a subclass of the given clazz.UnsupportedConstantPoolTypeException
- if a type is not supported for persistence in
the constant pool.java.lang.Object getObject(java.lang.Class<?> clazz, int cpi) throws UnsupportedConstantPoolTypeException
Class
instance. The implementor should support all additional types that
are necessary to serialize a truffle AST for a specific truffle implementation. If a type is
not supported by this constant pool implementation a
UnsupportedConstantPoolTypeException
should be thrown.clazz
- the Class
of the value in the constant pool.cpi
- the previously returned indexUnsupportedConstantPoolTypeException
- if a type is not supported for persistence in
the constant pool.java.lang.IllegalArgumentException
- if the provided cpi is not a valid constant pool index.int putClass(java.lang.Class<?> value)
value
- the class to storejava.lang.Class<?> getClass(int cpi)
Class
instance to the given constant pool index.cpi
- the constant pool indexjava.lang.IllegalArgumentException
- if the constant pool indes is invalid.int putInt(int value)
value
- the value to storeint getInt(int cpi)
cpi
- the constant pool indexjava.lang.IllegalArgumentException
- if the constant pool index is invalid.int putLong(long value)
value
- the value to storelong getLong(int cpi)
cpi
- the constant pool indexjava.lang.IllegalArgumentException
- if the constant pool index is invalid.int putDouble(double value)
value
- the value to storedouble getDouble(int cpi)
cpi
- the constant pool indexjava.lang.IllegalArgumentException
- if the constant pool index is invalid.int putFloat(float value)
value
- the value to storefloat getFloat(int cpi)
cpi
- the constant pool indexjava.lang.IllegalArgumentException
- if the constant pool index is invalid.