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 intBITS_MASK_IS_DEFAULTVALUE_AUTOINCprivate static intBITS_MASK_IS_GENERATED_COLUMNprivate java.lang.StringdefaultTextprivate DataValueDescriptordefaultValueThis class implements Formatable.private java.lang.StringoriginalCurrentSchemaprivate java.lang.String[]referencedColumnNamesprivate inttype
-
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 intcalcType(boolean isDefaultValueAutoinc)This function returns stored value for flags and so on.java.lang.StringgetDefaultText()Get the text of a default.DataValueDescriptorgetDefaultValue()Get the default value.java.lang.StringgetOriginalCurrentSchema()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.intgetTypeFormatId()Get the formatID which corresponds to this class.booleanisDefaultValueAutoinc()Is default value generated by auto increment?booleanisGeneratedColumn()Return true if this is the generation clause for a generated column.voidreadExternal(java.io.ObjectInput in)Read this object from a stream of stored objects.voidsetDefaultValue(DataValueDescriptor defaultValue)Set the default value.java.lang.StringtoString()voidwriteExternal(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:DefaultInfoGet the text of a default.- Specified by:
getDefaultTextin interfaceDefaultInfo- Returns:
- The text of the default.
- See Also:
DefaultInfo.getDefaultText()
-
getReferencedColumnNames
public java.lang.String[] getReferencedColumnNames()
Description copied from interface:DefaultInfoIf this default is a generation clause, then return the names of other columns in the row which the generation clause references.- Specified by:
getReferencedColumnNamesin interfaceDefaultInfo- See Also:
DefaultInfo.getReferencedColumnNames()
-
getOriginalCurrentSchema
public java.lang.String getOriginalCurrentSchema()
Description copied from interface:DefaultInfoReturn the name of the current schema when the default was created. This is filled in for generated columns.- Specified by:
getOriginalCurrentSchemain interfaceDefaultInfo- See Also:
DefaultInfo.getOriginalCurrentSchema()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this object from a stream of stored objects.- Specified by:
readExternalin 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.IOExceptionWrite this object to a stream of stored objects.- Specified by:
writeExternalin 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:
getTypeFormatIdin 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:DefaultInfoIs default value generated by auto increment?- Specified by:
isDefaultValueAutoincin interfaceDefaultInfo- Returns:
- true if always generated by auto increment.
- See Also:
DefaultInfo.isDefaultValueAutoinc()
-
isGeneratedColumn
public boolean isGeneratedColumn()
Description copied from interface:DefaultInfoReturn true if this is the generation clause for a generated column.- Specified by:
isGeneratedColumnin interfaceDefaultInfo- See Also:
DefaultInfo.isGeneratedColumn()
-
calcType
private static int calcType(boolean isDefaultValueAutoinc)
This function returns stored value for flags and so on.
-
-