net.ponder2.objects
Class P2Object

java.lang.Object
  extended by net.ponder2.objects.P2Object
All Implemented Interfaces:
java.io.Serializable, P2Serializable, Ponder2Message
Direct Known Subclasses:
DateTime, P2Array, P2Block, P2Boolean, P2Class, P2Error, P2Hash, P2Null, P2Number, P2ObjectAdaptor, P2String, P2XML

public abstract class P2Object
extends java.lang.Object
implements Ponder2Message, P2Serializable, java.io.Serializable

TODO Description

Version:
$Id:$
Author:
Kevin Twidle
See Also:
Serialized Form

Constructor Summary
protected P2Object()
          Empty constructor used for input serialisation
 
Method Summary
 P2Object[] asArray()
          Returns itself as an array of Ponder2 objects
 P2Block asBlock()
          Returns itself as a Ponder2 block
 boolean asBoolean()
          Returns itself as a boolean
 java.lang.Class<?> asClass()
          Returns itself as a Ponder2 class object
 double asDouble()
          Returns itself as a Double
 float asFloat()
          Returns itself as a Float
 P2Hash asHash()
          Returns itself as a Ponder2 hash
 int asInteger()
          Returns itself as an Integer
 long asLong()
          Returns itself as a Long integer
 java.math.BigDecimal asNumber()
          Returns itself as a BigDecimal number
 P2Array asP2Array()
          Returns itself as a Ponder2 Array
 java.lang.String asString()
          Returns itself as a String
static P2Null create()
           
static P2Number create(java.math.BigDecimal number)
           
static P2Boolean create(boolean value)
           
static P2Class create(java.lang.Class<?> name)
           
static P2Number create(double number)
           
static P2Number create(float number)
           
static P2Array create(int... values)
           
static P2Number create(int number)
           
static P2Number create(long number)
           
static P2Hash create(java.util.Map<java.lang.String,P2Object> hash)
           
static P2Block create(java.util.Map<java.lang.String,P2Object> variables, com.twicom.qdparser.TaggedElement block)
           
static P2Object create(P2ManagedObject mo)
           
static P2Array create(P2Object... values)
           
 P2Object create(P2Object source, java.lang.String operation, P2Object... args)
           
static P2Error create(Ponder2Exception exception)
           
static P2Array create(java.lang.String... values)
           
static P2String create(java.lang.String string)
           
static P2Object fromXml(com.twicom.qdparser.TaggedElement xml, java.util.Map<java.lang.Integer,P2Serializable> read)
           
 P2ManagedObject getManagedObject()
           
 OID getOID()
          Returns the Ponder2 Object Identifier of this object
static SelfManagedCell getSMC()
           
 P2Object operation(P2Object source, java.lang.String operation, P2Object... args)
          Performs operations on behalf of basic managed objects.
 P2Object operation(P2Object source, java.lang.String operation, java.lang.String arg1, java.lang.String... args)
           
abstract  P2Object readXml(com.twicom.qdparser.TaggedElement xml, java.util.Map<java.lang.Integer,P2Serializable> read)
           
static void setSMC(SelfManagedCell smc)
           
 com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P2Object

protected P2Object()
Empty constructor used for input serialisation

Method Detail

setSMC

public static void setSMC(SelfManagedCell smc)

getSMC

public static SelfManagedCell getSMC()

create

public static P2Null create()

create

public static P2Number create(java.math.BigDecimal number)

create

public static P2Number create(long number)

create

public static P2Number create(int number)

create

public static P2Number create(double number)

create

public static P2Number create(float number)

create

public static P2String create(java.lang.String string)

create

public static P2Hash create(java.util.Map<java.lang.String,P2Object> hash)

create

public static P2Object create(P2ManagedObject mo)

create

public static P2Array create(P2Object... values)

create

public static P2Array create(java.lang.String... values)

create

public static P2Array create(int... values)

create

public static P2Class create(java.lang.Class<?> name)

create

public static P2Error create(Ponder2Exception exception)

create

public static P2Boolean create(boolean value)

create

public static P2Block create(java.util.Map<java.lang.String,P2Object> variables,
                             com.twicom.qdparser.TaggedElement block)

fromXml

public static P2Object fromXml(com.twicom.qdparser.TaggedElement xml,
                               java.util.Map<java.lang.Integer,P2Serializable> read)
                        throws Ponder2OperationException,
                               Ponder2ArgumentException
Throws:
Ponder2OperationException
Ponder2ArgumentException

getManagedObject

public P2ManagedObject getManagedObject()

getOID

public OID getOID()
Returns the Ponder2 Object Identifier of this object

Returns:
the OID

asInteger

public int asInteger()
              throws Ponder2ArgumentException
Returns itself as an Integer

Returns:
the integer value
Throws:
Ponder2ArgumentException

asLong

public long asLong()
            throws Ponder2ArgumentException
Returns itself as a Long integer

Returns:
the long value
Throws:
Ponder2ArgumentException

asFloat

public float asFloat()
              throws Ponder2ArgumentException
Returns itself as a Float

Returns:
the float value
Throws:
Ponder2ArgumentException

asDouble

public double asDouble()
                throws Ponder2ArgumentException
Returns itself as a Double

Returns:
the double value
Throws:
Ponder2ArgumentException

asNumber

public java.math.BigDecimal asNumber()
                              throws Ponder2ArgumentException
Returns itself as a BigDecimal number

Returns:
the BigDecimal value
Throws:
Ponder2ArgumentException

asString

public java.lang.String asString()
                          throws Ponder2ArgumentException,
                                 Ponder2OperationException
Returns itself as a String

Returns:
the String value
Throws:
Ponder2ArgumentException
Ponder2OperationException

asArray

public P2Object[] asArray()
                   throws Ponder2ArgumentException
Returns itself as an array of Ponder2 objects

Returns:
the array value
Throws:
Ponder2ArgumentException

asP2Array

public P2Array asP2Array()
                  throws Ponder2ArgumentException
Returns itself as a Ponder2 Array

Returns:
the array value
Throws:
Ponder2ArgumentException

asBlock

public P2Block asBlock()
                throws Ponder2ArgumentException
Returns itself as a Ponder2 block

Returns:
the block value
Throws:
Ponder2ArgumentException

asHash

public P2Hash asHash()
              throws Ponder2ArgumentException,
                     Ponder2OperationException
Returns itself as a Ponder2 hash

Returns:
the hash value
Throws:
Ponder2ArgumentException
Ponder2OperationException

asBoolean

public boolean asBoolean()
                  throws Ponder2ArgumentException
Returns itself as a boolean

Returns:
the boolean value
Throws:
Ponder2ArgumentException

asClass

public java.lang.Class<?> asClass()
                           throws Ponder2ArgumentException
Returns itself as a Ponder2 class object

Returns:
a class value
Throws:
Ponder2ArgumentException

writeXml

public com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
                                           throws Ponder2OperationException
Specified by:
writeXml in interface P2Serializable
Throws:
Ponder2OperationException

readXml

public abstract P2Object readXml(com.twicom.qdparser.TaggedElement xml,
                                 java.util.Map<java.lang.Integer,P2Serializable> read)
                          throws Ponder2OperationException,
                                 Ponder2ArgumentException
Specified by:
readXml in interface P2Serializable
Throws:
Ponder2OperationException
Ponder2ArgumentException

create

public P2Object create(P2Object source,
                       java.lang.String operation,
                       P2Object... args)
                throws Ponder2Exception
Specified by:
create in interface Ponder2Message
Throws:
Ponder2Exception

operation

public P2Object operation(P2Object source,
                          java.lang.String operation,
                          P2Object... args)
                   throws Ponder2Exception
Performs operations on behalf of basic managed objects. If this operation is called we check that we have an adaptor and call that. If we don't have one we instantiate one and hang on to it.

Specified by:
operation in interface Ponder2Message
Throws:
Ponder2Exception
See Also:
Ponder2Message.operation(net.ponder2.objects.P2Object, java.lang.String, net.ponder2.objects.P2Object[])

operation

public P2Object operation(P2Object source,
                          java.lang.String operation,
                          java.lang.String arg1,
                          java.lang.String... args)
                   throws Ponder2Exception
Specified by:
operation in interface Ponder2Message
Throws:
Ponder2Exception


Copyright © 2008 Imperial College. All Rights Reserved.