public class PaddedTextType extends Object implements FixedSizeTextType
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
PaddedTextType.Alignment
Field justifications for padded values.
|
| Constructor and Description |
|---|
PaddedTextType(TextDataType type,
int size,
char pad,
PaddedTextType.Alignment alignment)
Produces a fixed-size type from another type.
|
| Modifier and Type | Method and Description |
|---|---|
TokenParser |
createParser(TextConversionContext ctx)
Creates a new parser for converting text into token values
|
PaddedTextType.Alignment |
getAlignment()
Gets the alignment for values.
|
TokenFormatter |
getFormatter(TextConversionContext ctx)
Creates a new formatter for converting token values into text
|
String |
getNullIndicator(TextConversionDefaults context)
Gets the string used to indicate null values for the type.
|
char |
getPad()
Gets the padding character for the type.
|
int |
getSize()
Gets the (constant) size of the text representation.
|
ScalarTokenType |
getTokenType()
Gets the token type used internally for the external type.
|
TextDataType |
getType()
Gets the underlying text type.
|
String |
toPattern()
Gets a string representing the format.
|
public PaddedTextType(TextDataType type, int size, char pad, PaddedTextType.Alignment alignment)
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
valuespublic TextDataType getType()
public char getPad()
public PaddedTextType.Alignment getAlignment()
public ScalarTokenType getTokenType()
TextDataTypegetTokenType in interface TextDataTypepublic int getSize()
FixedSizeTextTypegetSize in interface FixedSizeTextTypepublic TokenParser createParser(TextConversionContext ctx)
TextDataTypecreateParser in interface TextDataTypectx - context containing additional information needed by parserpublic String toPattern()
TextDataTypetoPattern in interface TextDataTypenull
if the format cannot be expressed this waypublic String getNullIndicator(TextConversionDefaults context)
TextDataTypegetNullIndicator in interface TextDataTypecontext - the schema defaults for the containing schemapublic TokenFormatter getFormatter(TextConversionContext ctx)
TextDataTypegetFormatter in interface TextDataTypectx - context containing additional information needed by parserCopyright © 2021 Actian Corporation. All rights reserved.