Class SequenceMetaData

java.lang.Object
org.apache.openjpa.meta.SequenceMetaData
All Implemented Interfaces:
Serializable, SourceTracker, Closeable, Commentable, MetaDataContext
Direct Known Subclasses:
SequenceMapping

public class SequenceMetaData extends Object implements SourceTracker, MetaDataContext, Closeable, Commentable, Serializable
Metadata about a named sequence.
Since:
0.4.0
Author:
Abe White
See Also:
  • Field Details

    • NAME_SYSTEM

      public static final String NAME_SYSTEM
      Sequence name that means to use the system default sequence.
      See Also:
    • IMPL_NATIVE

      public static final String IMPL_NATIVE
      Default plugin alias name; every back end should have some 'native' sequence implementation.
      See Also:
    • IMPL_TIME

      public static final String IMPL_TIME
      Time-based sequence values.
      See Also:
  • Constructor Details

  • Method Details

    • getRepository

      public MetaDataRepository getRepository()
      The owning repository.
      Specified by:
      getRepository in interface MetaDataContext
    • getName

      public String getName()
      The sequence name.
    • getSourceFile

      public File getSourceFile()
      Description copied from interface: SourceTracker
      Return the file from which this instance was parsed.
      Specified by:
      getSourceFile in interface SourceTracker
    • getSourceScope

      public Object getSourceScope()
      Description copied from interface: SourceTracker
      Return the domain-dependent scope of this instance within its file.
      Specified by:
      getSourceScope in interface SourceTracker
    • getSourceType

      public int getSourceType()
      Description copied from interface: SourceTracker
      Return the type of source.
      Specified by:
      getSourceType in interface SourceTracker
    • setSource

      public void setSource(File file, Object scope, int srcType)
    • getLineNumber

      public int getLineNumber()
      Description copied from interface: SourceTracker
      Return the line number of the file at which this instance was parsed.
      Specified by:
      getLineNumber in interface SourceTracker
    • setLineNumber

      public void setLineNumber(int lineNum)
    • getColNumber

      public int getColNumber()
      Description copied from interface: SourceTracker
      Return the column number in the line of the file at which this instance was parsed.
      Specified by:
      getColNumber in interface SourceTracker
    • setColNumber

      public void setColNumber(int colNum)
    • getResourceName

      public String getResourceName()
      Description copied from interface: SourceTracker
      Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.
      Specified by:
      getResourceName in interface SourceTracker
    • getType

      public int getType()
      The sequence type.
    • setType

      public void setType(int type)
      The sequence type.
    • getSequence

      public String getSequence()
      Native sequence name.
    • setSequence

      public void setSequence(String sequence)
      Native sequence name.
    • getIncrement

      public int getIncrement()
      Sequence increment, or -1 for default.
    • setIncrement

      public void setIncrement(int increment)
      Sequence increment, or -1 for default.
    • getAllocate

      public int getAllocate()
      Sequence values to allocate, or -1 for default.
    • setAllocate

      public void setAllocate(int allocate)
      Sequence values to allocate, or -1 for default.
    • getInitialValue

      public int getInitialValue()
      Initial sequence value, or -1 for default.
    • setInitialValue

      public void setInitialValue(int initial)
      Initial sequence value, or -1 for default.
    • getSequencePlugin

      public String getSequencePlugin()
      Plugin string describing the Seq.
    • setSequencePlugin

      public void setSequencePlugin(String plugin)
      Plugin string describing the Seq.
    • getSequenceFactory

      public SequenceMetaData.SequenceFactory getSequenceFactory()
      A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.
    • setSequenceFactory

      public void setSequenceFactory(SequenceMetaData.SequenceFactory factory)
      A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.
    • getInstance

      public Seq getInstance(ClassLoader envLoader)
      Return the initialized sequence instance.
    • instantiate

      protected Seq instantiate(ClassLoader envLoader)
      Create a new uninitialized instance of this sequence.
    • setSchema

      public void setSchema(String schema)
    • getSchema

      public String getSchema()
    • setCatalog

      public void setCatalog(String catalog)
    • getCatalog

      public String getCatalog()
    • newPluginValue

      protected PluginValue newPluginValue(String property)
      Create a new plugin value for sequences. Returns a standard SeqValue by default.
    • addStandardProperties

      protected void addStandardProperties(StringBuilder props)
      Add standard properties to the given properties buffer.
    • wrapValue

      protected String wrapValue(String value)
      Wraps property values that may contain spaces or other special characters in double quotes so they are processed as a single valued argument.
    • appendProperty

      protected void appendProperty(StringBuilder props, String name, String val)
      Add a string property to the buffer. Nothing will be added if value is null or empty string.
    • appendProperty

      protected void appendProperty(StringBuilder props, String name, int val)
      Add an int property to the buffer. Nothing will be added if value is -1.
    • close

      public void close()
      Close user sequence instance.
      Specified by:
      close in interface Closeable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getComments

      public String[] getComments()
      Description copied from interface: Commentable
      Return comments, or empty array if none.
      Specified by:
      getComments in interface Commentable
    • setComments

      public void setComments(String[] comments)
      Description copied from interface: Commentable
      Set comments.
      Specified by:
      setComments in interface Commentable