java.lang.Object
com.pervasive.datarush.schema.PaddedTextType
- All Implemented Interfaces:
FixedSizeTextType,TextDataType
A wrapper for creating
FixedSizeTextType objects from
arbitrary TextDataType objects.
Short values are padded with a single padding character according to specified justification with in the field. Long values are truncated on the right.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumField justifications for padded values. -
Constructor Summary
ConstructorsConstructorDescriptionPaddedTextType(TextDataType type, int size, char pad, PaddedTextType.Alignment alignment) Produces a fixed-size type from another type. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new parser for converting text into token valuesGets the alignment for values.Creates a new formatter for converting token values into textgetNullIndicator(TextConversionDefaults context) Gets the string used to indicate null values for the type.chargetPad()Gets the padding character for the type.intgetSize()Gets the (constant) size of the text representation.Gets the token type used internally for the external type.getType()Gets the underlying text type.Gets a string representing the format.
-
Constructor Details
-
PaddedTextType
Produces a fixed-size type from another type. Short values produced by the underlying formatter will be padded; long values will be truncated.- Parameters:
type- the type to be paddedsize- the width of the resulting typepad- the character with which short values are paddedalignment- how padding should be applied to short values
-
-
Method Details
-
getType
Gets the underlying text type.- Returns:
- the unpadded text type
-
getPad
public char getPad()Gets the padding character for the type.- Returns:
- the character used to pad values
-
getAlignment
Gets the alignment for values.- Returns:
- the alignment of values in the padding
-
getTokenType
Description copied from interface:TextDataTypeGets the token type used internally for the external type.- Specified by:
getTokenTypein interfaceTextDataType- Returns:
- the internal data type
-
getSize
public int getSize()Description copied from interface:FixedSizeTextTypeGets the (constant) size of the text representation.- Specified by:
getSizein interfaceFixedSizeTextType- Returns:
- the width of the field
-
createParser
Description copied from interface:TextDataTypeCreates a new parser for converting text into token values- Specified by:
createParserin interfaceTextDataType- Parameters:
ctx- context containing additional information needed by parser- Returns:
- a new parser object for the type
-
toPattern
Description copied from interface:TextDataTypeGets a string representing the format.- Specified by:
toPatternin interfaceTextDataType- Returns:
- the format string for the type,
nullif the format cannot be expressed this way
-
getNullIndicator
Description copied from interface:TextDataTypeGets the string used to indicate null values for the type.- Specified by:
getNullIndicatorin interfaceTextDataType- Parameters:
context- the schema defaults for the containing schema- Returns:
- the null indicator for the type
-
getFormatter
Description copied from interface:TextDataTypeCreates a new formatter for converting token values into text- Specified by:
getFormatterin interfaceTextDataType- Parameters:
ctx- context containing additional information needed by parser- Returns:
- a new formatter object for the type
-