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()
TextDataType
getTokenType
in interface TextDataType
public int getSize()
FixedSizeTextType
getSize
in interface FixedSizeTextType
public TokenParser createParser(TextConversionContext ctx)
TextDataType
createParser
in interface TextDataType
ctx
- context containing additional information needed by parserpublic String toPattern()
TextDataType
toPattern
in interface TextDataType
null
if the format cannot be expressed this waypublic String getNullIndicator(TextConversionDefaults context)
TextDataType
getNullIndicator
in interface TextDataType
context
- the schema defaults for the containing schemapublic TokenFormatter getFormatter(TextConversionContext ctx)
TextDataType
getFormatter
in interface TextDataType
ctx
- context containing additional information needed by parserCopyright © 2019 Actian Corporation. All rights reserved.