oscript.data
Class JavaObjectWrapper

java.lang.Object
  extended byoscript.data.Value
      extended byoscript.data.JavaObjectWrapper
All Implemented Interfaces:
java.io.Serializable

public class JavaObjectWrapper
extends Value

A wrapper for a java object.

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class oscript.data.Value
DEBUG, MEMBER_NAMES, NULL, PARENT_TYPE_NAME, TYPE, TYPE_NAME, UNDEFINED
 
Method Summary
 Value bopEquals(Value val)
          Perform the "==" operation.
 Value bopEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopGreaterThan(Value val)
          Perform the ">" operation.
 Value bopGreaterThanOrEquals(Value val)
          Perform the ">=" operation.
 Value bopGreaterThanOrEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopGreaterThanR(Value val, PackagedScriptObjectException e)
           
 Value bopLessThan(Value val)
          Perform the "<" operation.
 Value bopLessThanOrEquals(Value val)
          Perform the "<=" operation.
 Value bopLessThanOrEqualsR(Value val, PackagedScriptObjectException e)
           
 Value bopLessThanR(Value val, PackagedScriptObjectException e)
           
 Value bopNotEquals(Value val)
          Perform the "!=" operation.
 Value bopNotEqualsR(Value val, PackagedScriptObjectException e)
           
 boolean castToBoolean()
          Convert this object to a native java boolean value.
 long castToExactNumber()
          Convert this object to a native java long value.
 double castToInexactNumber()
          Convert this object to a native java double value.
 java.lang.Object castToJavaObject()
          Convert this object to a native java Object value.
 java.lang.String castToString()
          Convert this object to a native java String value.
 Value elementAt(Value idx)
          Get the specified index of this object, if this object is an array.
 Value elementsAt(Value idx1, Value idx2)
          Get the specified range of this object, if this object is an array.
 java.lang.Object getMonitor()
          Return the object used for implementing synchronized.
protected  Value getTypeImpl()
          Get the type of this object.
 int length()
          For types that implement elementAt, this returns the number of elements.
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, bopBitwiseAnd, bopBitwiseAndR, bopBitwiseOr, bopBitwiseOrR, bopBitwiseXor, bopBitwiseXorR, bopCast, bopCastR, bopDivide, bopDivideR, bopInstanceOf, bopInstanceOfR, bopLeftShift, bopLeftShiftR, bopLogicalAnd, bopLogicalAndR, bopLogicalOr, bopLogicalOrR, bopMinus, bopMinusR, bopMultiply, bopMultiplyR, bopPlus, bopPlusR, bopRemainder, bopRemainderR, bopSignedRightShift, bopSignedRightShiftR, bopUnsignedRightShift, bopUnsignedRightShiftR, callAsConstructor, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsExtends, callAsFunction, callAsFunction, callAsFunction, getMember, getMember, getMember, getMember, getMember, getMember, getType, getTypeMember, getTypeMember, isA, memberSet, noSuchMember, opAssign, populateMemberSet, populateTypeMemberSet, readExternal, toString, unhand, uopBitwiseNot, uopDecrement, uopIncrement, uopLogicalNot, uopMinus, uopPlus, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getTypeImpl

protected Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by Value.getType().

Specified by:
getTypeImpl in class Value
Returns:
the object's type

getMonitor

public java.lang.Object getMonitor()
Return the object used for implementing synchronized. For a normal script object, the object is it's own monitor. For a java object, it is the java object rather than the JavaObjectWrapper.

Overrides:
getMonitor in class Value
Returns:
the object to synchronize on

castToBoolean

public boolean castToBoolean()
                      throws PackagedScriptObjectException
Convert this object to a native java boolean value.

Overrides:
castToBoolean in class Value
Returns:
a boolean value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToString

public java.lang.String castToString()
                              throws PackagedScriptObjectException
Convert this object to a native java String value.

Overrides:
castToString in class Value
Returns:
a String value
Throws:
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException

castToExactNumber

public long castToExactNumber()
                       throws PackagedScriptObjectException
Convert this object to a native java long value.

Overrides:
castToExactNumber in class Value
Returns:
a long value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToInexactNumber

public double castToInexactNumber()
                           throws PackagedScriptObjectException
Convert this object to a native java double value.

Overrides:
castToInexactNumber in class Value
Returns:
a double value
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

castToJavaObject

public java.lang.Object castToJavaObject()
                                  throws PackagedScriptObjectException
Convert this object to a native java Object value.

Overrides:
castToJavaObject in class Value
Returns:
a java object
Throws:
PackagedScriptObjectException(NoSuchMethodException)
PackagedScriptObjectException

bopEquals

public Value bopEquals(Value val)
                throws PackagedScriptObjectException
Perform the "==" operation.

Overrides:
bopEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopEqualsR

public Value bopEqualsR(Value val,
                        PackagedScriptObjectException e)
                 throws PackagedScriptObjectException
Overrides:
bopEqualsR in class Value
Throws:
PackagedScriptObjectException

bopNotEquals

public Value bopNotEquals(Value val)
                   throws PackagedScriptObjectException
Perform the "!=" operation.

Overrides:
bopNotEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopNotEqualsR

public Value bopNotEqualsR(Value val,
                           PackagedScriptObjectException e)
                    throws PackagedScriptObjectException
Overrides:
bopNotEqualsR in class Value
Throws:
PackagedScriptObjectException

bopLessThan

public Value bopLessThan(Value val)
                  throws PackagedScriptObjectException
Perform the "<" operation.

Overrides:
bopLessThan in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanR

public Value bopLessThanR(Value val,
                          PackagedScriptObjectException e)
                   throws PackagedScriptObjectException
Overrides:
bopLessThanR in class Value
Throws:
PackagedScriptObjectException

bopGreaterThan

public Value bopGreaterThan(Value val)
                     throws PackagedScriptObjectException
Perform the ">" operation.

Overrides:
bopGreaterThan in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanR

public Value bopGreaterThanR(Value val,
                             PackagedScriptObjectException e)
                      throws PackagedScriptObjectException
Overrides:
bopGreaterThanR in class Value
Throws:
PackagedScriptObjectException

bopLessThanOrEquals

public Value bopLessThanOrEquals(Value val)
                          throws PackagedScriptObjectException
Perform the "<=" operation.

Overrides:
bopLessThanOrEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopLessThanOrEqualsR

public Value bopLessThanOrEqualsR(Value val,
                                  PackagedScriptObjectException e)
                           throws PackagedScriptObjectException
Overrides:
bopLessThanOrEqualsR in class Value
Throws:
PackagedScriptObjectException

bopGreaterThanOrEquals

public Value bopGreaterThanOrEquals(Value val)
                             throws PackagedScriptObjectException
Perform the ">=" operation.

Overrides:
bopGreaterThanOrEquals in class Value
Parameters:
val - the other value
Returns:
the result
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException

bopGreaterThanOrEqualsR

public Value bopGreaterThanOrEqualsR(Value val,
                                     PackagedScriptObjectException e)
                              throws PackagedScriptObjectException
Overrides:
bopGreaterThanOrEqualsR in class Value
Throws:
PackagedScriptObjectException

length

public int length()
           throws PackagedScriptObjectException
For types that implement elementAt, this returns the number of elements.

Overrides:
length in class Value
Returns:
an integer length
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
elementAt(oscript.data.Value), elementsAt(oscript.data.Value, oscript.data.Value)

elementAt

public Value elementAt(Value idx)
                throws PackagedScriptObjectException
Get the specified index of this object, if this object is an array. If needed, the array is grown to the appropriate size.

Overrides:
elementAt in class Value
Parameters:
idx - the index to get
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
length(), elementsAt(oscript.data.Value, oscript.data.Value)

elementsAt

public Value elementsAt(Value idx1,
                        Value idx2)
                 throws PackagedScriptObjectException
Get the specified range of this object, if this object is an array. This returns a copy of a range of the array.

Overrides:
elementsAt in class Value
Parameters:
idx1 - the index index of the beginning of the range, inclusive
idx2 - the index of the end of the range, inclusive
Returns:
a copy of the specified range of this array
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
length(), elementAt(oscript.data.Value)