java.lang.Comparable<ErlangValue>ErlangValueBitString, ErlangValueFastStringpublic class ErlangValue extends java.lang.Object implements java.lang.Comparable<ErlangValue>
ErlangValue(Object) for a list of compatible types.| Modifier and Type | Class | Description |
|---|---|---|
static interface |
ErlangValue.ListElementConverter<T> |
Converts list elements to a desired type.
|
static class |
ErlangValue.StringListElementConverter |
Converts list elements to
Strings. |
| Constructor | Description |
|---|---|
ErlangValue(com.ericsson.otp.erlang.OtpErlangObject value) |
Creates a new object wrapping the given erlang value.
|
ErlangValue(T value) |
Creates a new object from a given set of Java types.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.math.BigInteger |
bigIntValue() |
Returns the Java BigInteger value of the wrapped erlang value.
|
java.util.List<byte[]> |
binaryListValue() |
Returns a list of byte[] values of the wrapped erlang value.
|
byte[] |
binaryValue() |
Returns the Java byte[] value of the wrapped erlang value.
|
boolean |
boolValue() |
Returns the Java int value of the wrapped erlang value.
|
int |
compareTo(ErlangValue o) |
Compares two erlang values by their string representation (expensive!).
|
static <T> com.ericsson.otp.erlang.OtpErlangObject |
convertToErlang(T value) |
Converts a (supported) Java type to an
OtpErlangObject. |
java.util.List<java.lang.Double> |
doubleListValue() |
Returns a list of
Double values of the wrapped erlang value. |
double |
doubleValue() |
Returns the Java double value of the wrapped erlang value.
|
boolean |
equals(java.lang.Object obj) |
|
int |
hashCode() |
|
int |
intValue() |
Returns the Java int value of the wrapped erlang value.
|
<T> java.util.List<T> |
jsonListValue(java.lang.Class<T> c) |
Returns a list of JSON objects (as an instance of the given class) of the
wrapped erlang value.
|
java.util.Map<java.lang.String,java.lang.Object> |
jsonValue() |
Returns a JSON object (as
Map<String, Object>) of the
wrapped erlang value. |
<T> T |
jsonValue(java.lang.Class<T> c) |
Returns a JSON object (as an instance of the given class) of the wrapped
erlang value.
|
java.util.Collection<ErlangValue> |
listCollectionValue(java.lang.Class<? extends java.util.Collection<ErlangValue>> clazz) |
Returns a
Collection of mixed Java values (wrapped in
ErlangValue objects) of the wrapped erlang value (internally
represented as a list in Erlang). |
<T> java.util.Collection<T> |
listCollectionValue(java.lang.Class<? extends java.util.Collection<T>> clazz,
ErlangValue.ListElementConverter<T> converter) |
Returns a
Collection of mixed Java values of the wrapped erlang
value (internally represented as a list in Erlang). |
java.util.List<ErlangValue> |
listValue() |
Returns a list of mixed Java values (wrapped in
ErlangValue
objects) of the wrapped erlang value. |
<T> java.util.List<T> |
listValue(ErlangValue.ListElementConverter<T> converter) |
Returns a list of mixed Java values of the wrapped erlang value.
|
java.util.List<java.lang.Long> |
longListValue() |
Returns a list of
Long values of the wrapped erlang value. |
long |
longValue() |
Returns the Java long value of the wrapped erlang value.
|
static com.ericsson.otp.erlang.OtpErlangList |
otpObjectToOtpList(com.ericsson.otp.erlang.OtpErlangObject value) |
Converts an
OtpErlangObject to a OtpErlangList taking
special care if the OTP library converted a list to an
OtpErlangString. |
java.util.List<java.lang.String> |
stringListValue() |
Returns a list of
String values of the wrapped erlang value. |
java.lang.String |
stringValue() |
Returns the Java
String value of the wrapped erlang value. |
java.lang.String |
toString() |
|
com.ericsson.otp.erlang.OtpErlangObject |
value() |
Gets the original erlang value.
|
public ErlangValue(com.ericsson.otp.erlang.OtpErlangObject value)
value - a value from erlangpublic ErlangValue(T value)
throws java.lang.ClassCastException
Boolean - OtpErlangBooleanLong - OtpErlangLongInteger - OtpErlangLongBigInteger - OtpErlangLongDouble - OtpErlangDoubleString - OtpErlangStringOtpErlangBinaryList<Object> with one of the native types except
byte[] or another (supported) list/map - OtpErlangListCollection<Object> same as List<Object>
(internally represented as a list)Map<String, Object> representing a JSON object -
OtpErlangTupleOtpErlangObject - an arbitrary erlang valueErlangValueT - the type of the valuevalue - the value to convert to an erlang typejava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic static <T> com.ericsson.otp.erlang.OtpErlangObject convertToErlang(T value)
throws java.lang.ClassCastException
OtpErlangObject.T - the type of the valuevalue - the value to convert to an erlang typejava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic boolean boolValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supported or the value is too bigpublic int intValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supported or the value is too bigpublic long longValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supported or the value is too bigpublic java.math.BigInteger bigIntValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic double doubleValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic java.lang.String stringValue()
throws java.lang.ClassCastException
String value of the wrapped erlang value.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic byte[] binaryValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic java.util.Map<java.lang.String,java.lang.Object> jsonValue()
throws java.lang.ClassCastException
Map<String, Object>) of the
wrapped erlang value.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic <T> T jsonValue(java.lang.Class<T> c)
throws java.lang.ClassCastException
T - the type of the object to createc - the class of the created objectjava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic static com.ericsson.otp.erlang.OtpErlangList otpObjectToOtpList(com.ericsson.otp.erlang.OtpErlangObject value)
throws java.lang.ClassCastException
OtpErlangObject to a OtpErlangList taking
special care if the OTP library converted a list to an
OtpErlangString.value - the value to convertjava.lang.ClassCastException - if the conversion failspublic <T> java.util.List<T> listValue(ErlangValue.ListElementConverter<T> converter) throws java.lang.ClassCastException
T - type of the elements in the listconverter - object that converts the list value to the desired typejava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic <T> java.util.Collection<T> listCollectionValue(java.lang.Class<? extends java.util.Collection<T>> clazz,
ErlangValue.ListElementConverter<T> converter)
throws java.lang.ClassCastException
Collection of mixed Java values of the wrapped erlang
value (internally represented as a list in Erlang).T - type of the elements in the listclazz - class of the result typeconverter - object that converts the list value to the desired typejava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic java.util.List<ErlangValue> listValue() throws java.lang.ClassCastException
ErlangValue
objects) of the wrapped erlang value.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic java.util.Collection<ErlangValue> listCollectionValue(java.lang.Class<? extends java.util.Collection<ErlangValue>> clazz) throws java.lang.ClassCastException
Collection of mixed Java values (wrapped in
ErlangValue objects) of the wrapped erlang value (internally
represented as a list in Erlang).clazz - class of the result typejava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedpublic java.util.List<java.lang.Long> longListValue()
throws java.lang.ClassCastException
Long values of the wrapped erlang value.
Provided for convenience.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedlistValue(ListElementConverter)public java.util.List<java.lang.Double> doubleListValue()
throws java.lang.ClassCastException
Double values of the wrapped erlang value.
Provided for convenience.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedlistValue(ListElementConverter)public java.util.List<java.lang.String> stringListValue()
throws java.lang.ClassCastException
String values of the wrapped erlang value.
Provided for convenience.java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedlistValue(ListElementConverter)public java.util.List<byte[]> binaryListValue()
throws java.lang.ClassCastException
java.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedlistValue(ListElementConverter)public <T> java.util.List<T> jsonListValue(java.lang.Class<T> c)
throws java.lang.ClassCastException
T - the type of the object to create as a list elementc - the class of the created objectjava.lang.ClassCastException - if thrown if a conversion is not possible, i.e. the type is
not supportedlistValue(ListElementConverter)public com.ericsson.otp.erlang.OtpErlangObject value()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(ErlangValue o)
compareTo in interface java.lang.Comparable<ErlangValue>o - another erlang value