org.apache.openjpa.persistence
Class TupleImpl

java.lang.Object
  extended by org.apache.openjpa.persistence.TupleImpl
All Implemented Interfaces:
Tuple

public class TupleImpl
extends Object
implements Tuple

Tuple holds a set of values corresponding to a set of TupleElement. This implementation prefers index-based access. A Tuple instance is constructed by a TupleFactory. The TupleElemets are shared across all the tuple instances.

Author:
Pinaki Poddar

Field Summary
static Method PUT
           
 
Constructor Summary
TupleImpl(TupleFactory factory)
          Supply the factory that creates prototypes and holds the elements.
 
Method Summary
(package private)
<X> X
assertAndConvertType(String id, Object value, Class<X> type)
          Assert that the given value is convertible to the given type and convert.
 Object get(int i)
           
<X> X
get(int i, Class<X> type)
           
 Object get(String alias)
           
<X> X
get(String alias, Class<X> type)
           
<X> X
get(TupleElement<X> tupleElement)
           
 List<TupleElement<?>> getElements()
           
 void put(Integer key, Object value)
          Put the value at the given key index.
 Object[] toArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUT

public static Method PUT
Constructor Detail

TupleImpl

TupleImpl(TupleFactory factory)
Supply the factory that creates prototypes and holds the elements.

Method Detail

get

public <X> X get(TupleElement<X> tupleElement)
Specified by:
get in interface Tuple

get

public <X> X get(String alias,
                 Class<X> type)
Specified by:
get in interface Tuple

get

public Object get(String alias)
Specified by:
get in interface Tuple

get

public <X> X get(int i,
                 Class<X> type)
Specified by:
get in interface Tuple

get

public Object get(int i)
Specified by:
get in interface Tuple

toArray

public Object[] toArray()
Specified by:
toArray in interface Tuple

getElements

public List<TupleElement<?>> getElements()
Specified by:
getElements in interface Tuple

put

public void put(Integer key,
                Object value)
Put the value at the given key index. This is invoked by the kernel to populate a Tuple.


assertAndConvertType

<X> X assertAndConvertType(String id,
                           Object value,
                           Class<X> type)
Assert that the given value is convertible to the given type and convert. null type implies no conversion and a pure cast.



Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.