Package org.apache.derby.catalog.types
Class DefaultInfoImpl
java.lang.Object
org.apache.derby.catalog.types.DefaultInfoImpl
- All Implemented Interfaces:
Externalizable
,Serializable
,DefaultInfo
,Formatable
,TypedFormat
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private String
private DataValueDescriptor
This class implements Formatable.private String
private String[]
private int
-
Constructor Summary
ConstructorsConstructorDescriptionPublic niladic constructor.DefaultInfoImpl
(boolean isDefaultValueAutoinc, String defaultText, DataValueDescriptor defaultValue) Constructor for use with numeric typesDefaultInfoImpl
(String defaultText, String[] referencedColumnNames, String originalCurrentSchema) Constructor for use with generated columns -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
calcType
(boolean isDefaultValueAutoinc) This function returns stored value for flags and so on.Get the text of a default.Get the default value.Return the name of the current schema when the default was created.String[]
If this default is a generation clause, then return the names of other columns in the row which the generation clause references.int
Get the formatID which corresponds to this class.boolean
Is default value generated by auto increment?boolean
Return true if this is the generation clause for a generated column.void
Read this object from a stream of stored objects.void
setDefaultValue
(DataValueDescriptor defaultValue) Set the default value.toString()
void
Write this object to a stream of stored objects.
-
Field Details
-
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
-
type
private int type -
referencedColumnNames
-
originalCurrentSchema
-
BITS_MASK_IS_DEFAULTVALUE_AUTOINC
private static final int BITS_MASK_IS_DEFAULTVALUE_AUTOINC- See Also:
-
BITS_MASK_IS_GENERATED_COLUMN
private static final int BITS_MASK_IS_GENERATED_COLUMN- See Also:
-
-
Constructor Details
-
DefaultInfoImpl
public DefaultInfoImpl()Public niladic constructor. Needed for Formatable interface to work. -
DefaultInfoImpl
public DefaultInfoImpl(boolean isDefaultValueAutoinc, String defaultText, DataValueDescriptor defaultValue) Constructor for use with numeric types- Parameters:
defaultText
- The text of the default.
-
DefaultInfoImpl
public DefaultInfoImpl(String defaultText, String[] referencedColumnNames, 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 Details
-
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:
-
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:
-
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:
-
toString
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
writeExternal
Write this object to a stream of stored objects.- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- write bytes here.- Throws:
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
Get the default value. (NOTE: This returns null if the default is not a constant.)- Returns:
- The default value.
-
setDefaultValue
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:
-
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:
-
calcType
private static int calcType(boolean isDefaultValueAutoinc) This function returns stored value for flags and so on.
-