Package org.apache.openjpa.meta
Class SequenceMetaData
- java.lang.Object
-
- org.apache.openjpa.meta.SequenceMetaData
-
- All Implemented Interfaces:
java.io.Serializable,SourceTracker,Closeable,Commentable,MetaDataContext
- Direct Known Subclasses:
SequenceMapping
public class SequenceMetaData extends java.lang.Object implements SourceTracker, MetaDataContext, Closeable, Commentable, java.io.Serializable
Metadata about a named sequence.- Since:
- 0.4.0
- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSequenceMetaData.SequenceFactoryAllow facades to supply adapters from a spec sequence type to the OpenJPA sequence type.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIMPL_NATIVEDefault plugin alias name; every back end should have some 'native' sequence implementation.static java.lang.StringIMPL_TIMETime-based sequence values.static java.lang.StringNAME_SYSTEMSequence name that means to use the system default sequence.-
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
-
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
-
Constructor Summary
Constructors Constructor Description SequenceMetaData(java.lang.String name, MetaDataRepository repos)Constructor; supply sequence name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStandardProperties(java.lang.StringBuilder props)Add standard properties to the given properties buffer.protected voidappendProperty(java.lang.StringBuilder props, java.lang.String name, int val)Add an int property to the buffer.protected voidappendProperty(java.lang.StringBuilder props, java.lang.String name, java.lang.String val)Add a string property to the buffer.voidclose()Close user sequence instance.intgetAllocate()Sequence values to allocate, or -1 for default.java.lang.StringgetCatalog()intgetColNumber()Return the column number in the line of the file at which this instance was parsed.java.lang.String[]getComments()Return comments, or empty array if none.intgetIncrement()Sequence increment, or -1 for default.intgetInitialValue()Initial sequence value, or -1 for default.SeqgetInstance(java.lang.ClassLoader envLoader)Return the initialized sequence instance.intgetLineNumber()Return the line number of the file at which this instance was parsed.java.lang.StringgetName()The sequence name.MetaDataRepositorygetRepository()The owning repository.java.lang.StringgetResourceName()Return the domain-meaningful name of the resource that was loaded from this source.java.lang.StringgetSchema()java.lang.StringgetSequence()Native sequence name.SequenceMetaData.SequenceFactorygetSequenceFactory()A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.java.lang.StringgetSequencePlugin()Plugin string describing theSeq.java.io.FilegetSourceFile()Return the file from which this instance was parsed.java.lang.ObjectgetSourceScope()Return the domain-dependent scope of this instance within its file.intgetSourceType()Return the type of source.intgetType()The sequence type.protected Seqinstantiate(java.lang.ClassLoader envLoader)Create a new uninitialized instance of this sequence.protected PluginValuenewPluginValue(java.lang.String property)Create a new plugin value for sequences.voidsetAllocate(int allocate)Sequence values to allocate, or -1 for default.voidsetCatalog(java.lang.String catalog)voidsetColNumber(int colNum)voidsetComments(java.lang.String[] comments)Set comments.voidsetIncrement(int increment)Sequence increment, or -1 for default.voidsetInitialValue(int initial)Initial sequence value, or -1 for default.voidsetLineNumber(int lineNum)voidsetSchema(java.lang.String schema)voidsetSequence(java.lang.String sequence)Native sequence name.voidsetSequenceFactory(SequenceMetaData.SequenceFactory factory)A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.voidsetSequencePlugin(java.lang.String plugin)Plugin string describing theSeq.voidsetSource(java.io.File file, java.lang.Object scope, int srcType)voidsetType(int type)The sequence type.java.lang.StringtoString()protected java.lang.StringwrapValue(java.lang.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.
-
-
-
Field Detail
-
NAME_SYSTEM
public static final java.lang.String NAME_SYSTEM
Sequence name that means to use the system default sequence.- See Also:
- Constant Field Values
-
IMPL_NATIVE
public static final java.lang.String IMPL_NATIVE
Default plugin alias name; every back end should have some 'native' sequence implementation.- See Also:
- Constant Field Values
-
IMPL_TIME
public static final java.lang.String IMPL_TIME
Time-based sequence values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SequenceMetaData
public SequenceMetaData(java.lang.String name, MetaDataRepository repos)Constructor; supply sequence name.
-
-
Method Detail
-
getRepository
public MetaDataRepository getRepository()
The owning repository.- Specified by:
getRepositoryin interfaceMetaDataContext
-
getName
public java.lang.String getName()
The sequence name.
-
getSourceFile
public java.io.File getSourceFile()
Description copied from interface:SourceTrackerReturn the file from which this instance was parsed.- Specified by:
getSourceFilein interfaceSourceTracker
-
getSourceScope
public java.lang.Object getSourceScope()
Description copied from interface:SourceTrackerReturn the domain-dependent scope of this instance within its file.- Specified by:
getSourceScopein interfaceSourceTracker
-
getSourceType
public int getSourceType()
Description copied from interface:SourceTrackerReturn the type of source.- Specified by:
getSourceTypein interfaceSourceTracker
-
setSource
public void setSource(java.io.File file, java.lang.Object scope, int srcType)
-
getLineNumber
public int getLineNumber()
Description copied from interface:SourceTrackerReturn the line number of the file at which this instance was parsed.- Specified by:
getLineNumberin interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum)
-
getColNumber
public int getColNumber()
Description copied from interface:SourceTrackerReturn the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumberin interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum)
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:SourceTrackerReturn 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:
getResourceNamein interfaceSourceTracker
-
getType
public int getType()
The sequence type.
-
setType
public void setType(int type)
The sequence type.
-
getSequence
public java.lang.String getSequence()
Native sequence name.
-
setSequence
public void setSequence(java.lang.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 java.lang.String getSequencePlugin()
Plugin string describing theSeq.
-
setSequencePlugin
public void setSequencePlugin(java.lang.String plugin)
Plugin string describing theSeq.
-
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(java.lang.ClassLoader envLoader)
Return the initialized sequence instance.
-
instantiate
protected Seq instantiate(java.lang.ClassLoader envLoader)
Create a new uninitialized instance of this sequence.
-
setSchema
public void setSchema(java.lang.String schema)
-
getSchema
public java.lang.String getSchema()
-
setCatalog
public void setCatalog(java.lang.String catalog)
-
getCatalog
public java.lang.String getCatalog()
-
newPluginValue
protected PluginValue newPluginValue(java.lang.String property)
Create a new plugin value for sequences. Returns a standardSeqValueby default.
-
addStandardProperties
protected void addStandardProperties(java.lang.StringBuilder props)
Add standard properties to the given properties buffer.
-
wrapValue
protected java.lang.String wrapValue(java.lang.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(java.lang.StringBuilder props, java.lang.String name, java.lang.String val)Add a string property to the buffer. Nothing will be added if value is null or empty string.
-
appendProperty
protected void appendProperty(java.lang.StringBuilder props, java.lang.String name, int val)Add an int property to the buffer. Nothing will be added if value is -1.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getComments
public java.lang.String[] getComments()
Description copied from interface:CommentableReturn comments, or empty array if none.- Specified by:
getCommentsin interfaceCommentable
-
setComments
public void setComments(java.lang.String[] comments)
Description copied from interface:CommentableSet comments.- Specified by:
setCommentsin interfaceCommentable
-
-