- java.lang.Object
-
- com.pervasive.datarush.schema.PaddedTextType
-
- All Implemented Interfaces:
FixedSizeTextType,TextDataType
public class PaddedTextType extends Object implements FixedSizeTextType
A wrapper for creatingFixedSizeTextTypeobjects from arbitraryTextDataTypeobjects.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 Classes Modifier and Type Class Description static classPaddedTextType.AlignmentField justifications for padded values.
-
Constructor Summary
Constructors Constructor Description PaddedTextType(TextDataType type, int size, char pad, PaddedTextType.Alignment alignment)Produces a fixed-size type from another type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenParsercreateParser(TextConversionContext ctx)Creates a new parser for converting text into token valuesPaddedTextType.AlignmentgetAlignment()Gets the alignment for values.TokenFormattergetFormatter(TextConversionContext ctx)Creates a new formatter for converting token values into textStringgetNullIndicator(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.ScalarTokenTypegetTokenType()Gets the token type used internally for the external type.TextDataTypegetType()Gets the underlying text type.StringtoPattern()Gets a string representing the format.
-
-
-
Constructor Detail
-
PaddedTextType
public PaddedTextType(TextDataType type, int size, char pad, PaddedTextType.Alignment alignment)
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 Detail
-
getType
public TextDataType 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
public PaddedTextType.Alignment getAlignment()
Gets the alignment for values.- Returns:
- the alignment of values in the padding
-
getTokenType
public ScalarTokenType 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
public TokenParser createParser(TextConversionContext ctx)
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
public String 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
public String getNullIndicator(TextConversionDefaults context)
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
public TokenFormatter getFormatter(TextConversionContext ctx)
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
-
-