Package org.apache.derby.catalog.types
Class DefaultInfoImpl
- java.lang.Object
-
- org.apache.derby.catalog.types.DefaultInfoImpl
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,DefaultInfo
,Formatable
,TypedFormat
public class DefaultInfoImpl extends java.lang.Object implements DefaultInfo, Formatable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BITS_MASK_IS_DEFAULTVALUE_AUTOINC
private static int
BITS_MASK_IS_GENERATED_COLUMN
private java.lang.String
defaultText
private DataValueDescriptor
defaultValue
This class implements Formatable.private java.lang.String
originalCurrentSchema
private java.lang.String[]
referencedColumnNames
private int
type
-
Constructor Summary
Constructors Constructor Description DefaultInfoImpl()
Public niladic constructor.DefaultInfoImpl(boolean isDefaultValueAutoinc, java.lang.String defaultText, DataValueDescriptor defaultValue)
Constructor for use with numeric typesDefaultInfoImpl(java.lang.String defaultText, java.lang.String[] referencedColumnNames, java.lang.String originalCurrentSchema)
Constructor for use with generated columns
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
calcType(boolean isDefaultValueAutoinc)
This function returns stored value for flags and so on.java.lang.String
getDefaultText()
Get the text of a default.DataValueDescriptor
getDefaultValue()
Get the default value.java.lang.String
getOriginalCurrentSchema()
Return the name of the current schema when the default was created.java.lang.String[]
getReferencedColumnNames()
If this default is a generation clause, then return the names of other columns in the row which the generation clause references.int
getTypeFormatId()
Get the formatID which corresponds to this class.boolean
isDefaultValueAutoinc()
Is default value generated by auto increment?boolean
isGeneratedColumn()
Return true if this is the generation clause for a generated column.void
readExternal(java.io.ObjectInput in)
Read this object from a stream of stored objects.void
setDefaultValue(DataValueDescriptor defaultValue)
Set the default value.java.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
Write this object to a stream of stored objects.
-
-
-
Field Detail
-
defaultValue
private DataValueDescriptor defaultValue
This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method.
-
defaultText
private java.lang.String defaultText
-
type
private int type
-
referencedColumnNames
private java.lang.String[] referencedColumnNames
-
originalCurrentSchema
private java.lang.String originalCurrentSchema
-
BITS_MASK_IS_DEFAULTVALUE_AUTOINC
private static final int BITS_MASK_IS_DEFAULTVALUE_AUTOINC
- See Also:
- Constant Field Values
-
BITS_MASK_IS_GENERATED_COLUMN
private static final int BITS_MASK_IS_GENERATED_COLUMN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultInfoImpl
public DefaultInfoImpl()
Public niladic constructor. Needed for Formatable interface to work.
-
DefaultInfoImpl
public DefaultInfoImpl(boolean isDefaultValueAutoinc, java.lang.String defaultText, DataValueDescriptor defaultValue)
Constructor for use with numeric types- Parameters:
defaultText
- The text of the default.
-
DefaultInfoImpl
public DefaultInfoImpl(java.lang.String defaultText, java.lang.String[] referencedColumnNames, java.lang.String originalCurrentSchema)
Constructor for use with generated columns- Parameters:
defaultText
- Text of generation clause.referencedColumnNames
- names of other columns in the base row which are mentioned in the generation clause.originalCurrentSchema
- Schema in effect when the generate column was added to the table.
-
-
Method Detail
-
getDefaultText
public java.lang.String getDefaultText()
Description copied from interface:DefaultInfo
Get the text of a default.- Specified by:
getDefaultText
in interfaceDefaultInfo
- Returns:
- The text of the default.
- See Also:
DefaultInfo.getDefaultText()
-
getReferencedColumnNames
public java.lang.String[] getReferencedColumnNames()
Description copied from interface:DefaultInfo
If this default is a generation clause, then return the names of other columns in the row which the generation clause references.- Specified by:
getReferencedColumnNames
in interfaceDefaultInfo
- See Also:
DefaultInfo.getReferencedColumnNames()
-
getOriginalCurrentSchema
public java.lang.String getOriginalCurrentSchema()
Description copied from interface:DefaultInfo
Return the name of the current schema when the default was created. This is filled in for generated columns.- Specified by:
getOriginalCurrentSchema
in interfaceDefaultInfo
- See Also:
DefaultInfo.getOriginalCurrentSchema()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfacejava.io.Externalizable
- Parameters:
in
- read this.- Throws:
java.io.IOException
- thrown on errorjava.lang.ClassNotFoundException
- thrown on error
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Write this object to a stream of stored objects.- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Parameters:
out
- write bytes here.- Throws:
java.io.IOException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()
Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
getDefaultValue
public DataValueDescriptor getDefaultValue()
Get the default value. (NOTE: This returns null if the default is not a constant.)- Returns:
- The default value.
-
setDefaultValue
public void setDefaultValue(DataValueDescriptor defaultValue)
Set the default value.- Parameters:
defaultValue
- The default value.
-
isDefaultValueAutoinc
public boolean isDefaultValueAutoinc()
Description copied from interface:DefaultInfo
Is default value generated by auto increment?- Specified by:
isDefaultValueAutoinc
in interfaceDefaultInfo
- Returns:
- true if always generated by auto increment.
- See Also:
DefaultInfo.isDefaultValueAutoinc()
-
isGeneratedColumn
public boolean isGeneratedColumn()
Description copied from interface:DefaultInfo
Return true if this is the generation clause for a generated column.- Specified by:
isGeneratedColumn
in interfaceDefaultInfo
- See Also:
DefaultInfo.isGeneratedColumn()
-
calcType
private static int calcType(boolean isDefaultValueAutoinc)
This function returns stored value for flags and so on.
-
-