org.apache.openjpa.kernel
Class DelegatingSeq

java.lang.Object
  extended by org.apache.openjpa.kernel.DelegatingSeq
All Implemented Interfaces:
Seq, Closeable

public class DelegatingSeq
extends Object
implements Seq

Delegating sequence that can also perform exception translation for use in facades.

Author:
Abe White

Field Summary
 
Fields inherited from interface org.apache.openjpa.kernel.Seq
TYPE_CONTIGUOUS, TYPE_DEFAULT, TYPE_NONTRANSACTIONAL, TYPE_TRANSACTIONAL
 
Constructor Summary
DelegatingSeq(Seq seq)
          Constructor; supply delegate.
DelegatingSeq(Seq seq, RuntimeExceptionTranslator trans)
          Constructor; supply delegate and exception translator.
 
Method Summary
 void allocate(int additional, StoreContext ctx, ClassMetaData meta)
          Allocate additional values efficiently.
 void close()
          Free resources used by this sequence.
 Object current(StoreContext ctx, ClassMetaData meta)
          Return the current value of the sequence, or null if not available.
 boolean equals(Object other)
           
 Seq getDelegate()
          Return the direct delegate.
 Seq getInnermostDelegate()
          Return the native delegate.
 int hashCode()
           
 Object next(StoreContext ctx, ClassMetaData meta)
          Return the next value in the sequence.
 void setType(int type)
          Set the type of sequence.
protected  RuntimeException translate(RuntimeException re)
          Translate the OpenJPA exception.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingSeq

public DelegatingSeq(Seq seq)
Constructor; supply delegate.


DelegatingSeq

public DelegatingSeq(Seq seq,
                     RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator.

Method Detail

getDelegate

public Seq getDelegate()
Return the direct delegate.


getInnermostDelegate

public Seq getInnermostDelegate()
Return the native delegate.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

translate

protected RuntimeException translate(RuntimeException re)
Translate the OpenJPA exception.


setType

public void setType(int type)
Description copied from interface: Seq
Set the type of sequence.

Specified by:
setType in interface Seq

next

public Object next(StoreContext ctx,
                   ClassMetaData meta)
Description copied from interface: Seq
Return the next value in the sequence.

Specified by:
next in interface Seq
Parameters:
ctx - the current context
meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null

current

public Object current(StoreContext ctx,
                      ClassMetaData meta)
Description copied from interface: Seq
Return the current value of the sequence, or null if not available.

Specified by:
current in interface Seq
Parameters:
ctx - the current context
meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null

allocate

public void allocate(int additional,
                     StoreContext ctx,
                     ClassMetaData meta)
Description copied from interface: Seq
Allocate additional values efficiently.

Specified by:
allocate in interface Seq
ctx - the current context
meta - if this is a datastore identity sequence, the persistent class the identity value is for; else null

close

public void close()
Description copied from interface: Seq
Free resources used by this sequence.

Specified by:
close in interface Seq
Specified by:
close in interface Closeable


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