Additional top-level class in compilation unit: AbstractValue.
host or guest language. Polyglot
values are bound to a context. If the context is closed then all value operations
throw an IllegalStateException.
Polyglot values have one of the following type combinations:
Null: This value represents a null like value. Certain
languages might use a different name or use multiple values to represent null like
values.
Number: This value represents a floating or fixed point number. The
number value may be accessed as byte, short, int, long, asBigInteger() BigInteger}, float, or
double value.
Boolean. This value represents a boolean value. The boolean value can be
accessed using asBoolean().
String: This value represents a string value. The string value can be
accessed using asString().
Date, Time or Timezone: This value
represents a date, time or timezone. Multiple types may return true at the same
time.
Duration: This value represents a duration value. The duration value
can be accessed using asDuration().
Host Object: This value represents a value of the host language
(Java). The original Java value can be accessed using asHostObject().
Proxy Object: This value represents a proxy value.
Native Pointer: This value represents a native pointer. The native
pointer value can be accessed using asNativePointer().
Exception: This value represents an exception object. The exception
can be thrown using throwException().
Meta-Object: This value represents a metaobject. Access metaobject
operations using getMetaSimpleName(), getMetaQualifiedName() and
isMetaInstance(Object).
Iterator: This value represents an iterator. The iterator can be
iterated using hasIteratorNextElement() and getIteratorNextElement().
Array Elements: This value may contain array elements. The array
indices always start with 0, also if the language uses a different style.
Members: This value may contain members. Members are structural
elements of an object. For example, the members of a Java object are all public methods and
fields. Members are accessible using getMember(String).
Executable: This value can be executed.
This indicates that the value represents an element that can be executed. Guest language examples
for executable elements are functions, methods, closures or promises.
Instantiable: This value can be instantiated. For example, Java classes are instantiable.
Buffer Elements: This value may contain buffer elements. The
buffer indices always start with 0, also if the language uses a different style.
Iterable: This value provides an
iterator which can be used to iterate
value elements. For example, Guest language arrays are iterable.
hasHashEntries() Hash Entries}: This value represents a map.
hasMetaParents() Meta Parents}: This value represents Array Elements of Meta
Objects.
In addition to the language agnostic types, the language specific type can be accessed using
getMetaObject(). The identity of value objects is unspecified and should not be relied
upon. For example, multiple calls to getArrayElement(long) with the same index might
return the same or different instances of Value. The equality of
values is based on the identity of the value instance. All values return a human-readable
string for debugging, formatted by the original language.
Polyglot values may be converted to host objects using as(Class). In addition values may
be created from Java values using Context#asValue(Object).
If a date or time value has a timezone then it is called aware,
otherwise naive.
An aware time and date has sufficient knowledge of applicable algorithmic and political time adjustments, such as time zone and daylight saving time information, to locate itself relative to other aware objects. An aware object is used to represent a specific moment in time that is not open to interpretation.
A naive time and date does not contain enough information to unambiguously locate itself relative to other date/time objects. Whether a naive object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it is up to the program whether a particular number represents metres, miles, or mass. Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.
HostAccess, such values are released when the function returns, with all future
invocations of value operations throwing an exception.
If an embedder wishes to extend the scope of the value beyond the callback's return, the value
can be pinned, such that it is not released automatically.
Context, Engine, PolyglotException
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public <T> T | |
| public <T> T | |
| public BigInteger | |
| public boolean | |
| public byte | |
| public LocalDate | |
| public double | |
| public Duration | |
| public float | |
| public <T> T | |
| public Instant | |
| public int | |
| public long | |
| public long | |
| public <T extends Proxy> T | |
| public short | |
| public String | |
| public LocalTime | |
| public ZoneId | |
| public static Value | |
| public boolean | |
| public boolean | |
| public boolean | canInvokeMember(String
the member identifier identifier)Returns |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides org. Compares the identity of the underlying polyglot objects. |
| public Value | |
| public void | |
| public boolean | fitsInBigInteger()
Returns |
| public boolean | |
| public boolean | fitsInDouble()
Returns |
| public boolean | fitsInFloat()
Returns |
| public boolean | |
| public boolean | |
| public boolean | fitsInShort()
Returns |
| public Value | |
| public long | |
| public long | |
| public Context | |
| public Value | |
| public Value | |
| public long | |
| public Value | getHashValue(Object key)
Returns the value for the specified key or |
| public Value | getHashValueOrDefault(Object key, Object defaultValue)
Returns the value for the specified key or the default value if the mapping for the specified key does not exist or is not readable. |
| public Value | |
| public Value | |
| public Value | |
| public Value | |
| public Set | |
| public Value | getMetaObject()
Returns the metaobject that is associated with this value or |
| public Value | |
| public String | |
| public String | |
| public SourceSection | Returns: theSourceSection or null if unknownReturns the declared source location of the value. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public int | hashCode()
Overrides org. Returns the identity hash code of the underlying object. |
| public boolean | |
| public boolean | hasIteratorNextElement()
Returns |
| public boolean | |
| public boolean | |
| public boolean | hasMetaParents()
Returns |
| public Value | invokeMember(String
the member identifier to invoke identifier, Object... the invocation arguments arguments)Invokes the given member of this value. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isMetaInstance(Object
the instance object to check. instance)Returns |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public Value | |
| public void | |
| public void | |
| public void | |
| public byte | Returns: the byte at the given byte offset from the start of the buffer.the offset, in bytes, from the start of the buffer at which the byte will
be read. byteOffset)Reads the byte at the given byte offset from the start of the buffer. |
| public double | Returns: the double at the given byte offset from the start of the buffer.the order in which to write the individual bytes of the double. order, long the offset, in bytes, from the start of the buffer from which the double
will be read. byteOffset)Reads the double at the given byte offset from the start of the buffer in the given byte order. |
| public float | Returns: the float at the given byte offset from the start of the buffer.the order in which to read the individual bytes of the float. order, long the offset, in bytes, from the start of the buffer from which the float
will be read. byteOffset)Reads the float at the given byte offset from the start of the buffer in the given byte order. |
| public int | Returns: the int at the given byte offset from the start of the buffer.the order in which to read the individual bytes of the int. order, long the offset, in bytes, from the start of the buffer from which the int will
be read. byteOffset)Reads the int at the given byte offset from the start of the buffer in the given byte order. |
| public long | Returns: the int at the given byte offset from the start of the buffer.the order in which to read the individual bytes of the long. order, long the offset, in bytes, from the start of the buffer from which the int will
be read. byteOffset)Reads the long at the given byte offset from the start of the buffer in the given byte order. |
| public short | Returns: the short at the given byte offset from the start of the buffer.the order in which to read the individual bytes of the short. order, long the offset, in bytes, from the start of the buffer from which the short
will be read. byteOffset)Reads the short at the given byte offset from the start of the buffer in the given byte order. |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | |
| public RuntimeException | |
| public String | toString()
Overrides org. Converts this value to a human readable string. |
| public void | writeBufferByte(long
the offset, in bytes, from the start of the buffer at which the byte will
be written. byteOffset, byte the byte value to be written. value)Writes the given byte at the given byte offset from the start of the buffer. |
| public void | writeBufferDouble(ByteOrder
the order in which to write the individual bytes of the double. order, long the offset, in bytes, from the start of the buffer from which the double
will be written. byteOffset, double the double value to be written. value)Writes the given double in the given byte order at the given byte offset from the start of the buffer. |
| public void | writeBufferFloat(ByteOrder
the order in which to read the individual bytes of the float. order, long the offset, in bytes, from the start of the buffer from which the float
will be written. byteOffset, float the float value to be written. value)Writes the given float in the given byte order at the given byte offset from the start of the buffer. |
| public void | writeBufferInt(ByteOrder
the order in which to write the individual bytes of the int. order, long the offset, in bytes, from the start of the buffer from which the int will
be written. byteOffset, int the int value to be written. value)Writes the given int in the given byte order at the given byte offset from the start of the buffer. |
| public void | writeBufferLong(ByteOrder
the order in which to write the individual bytes of the long. order, long the offset, in bytes, from the start of the buffer from which the int will
be written. byteOffset, long the int value to be written. value)Writes the given long in the given byte order at the given byte offset from the start of the buffer. |
| public void | writeBufferShort(ByteOrder
the order in which to write the individual bytes of the short. order, long the offset, in bytes, from the start of the buffer from which the short
will be written. byteOffset, short the short value to be written. value)Writes the given short in the given byte order at the given byte offset from the start of the buffer. |