Package org.beanio.builder
Class FieldBuilder
- java.lang.Object
-
- org.beanio.builder.PropertyBuilderSupport<FieldBuilder>
-
- org.beanio.builder.FieldBuilder
-
public class FieldBuilder extends PropertyBuilderSupport<FieldBuilder>
Builds a new field configuration.- Since:
- 2.1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected FieldConfigconfig
-
Constructor Summary
Constructors Constructor Description FieldBuilder(java.lang.String name)Constructs a new FieldBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldBuilderalign(Align align)Sets the alignment or justification of this field if padded.FieldBuilderat(int at)Sets the position of the field.FieldConfigbuild()Builds this field.FieldBuilderdefaultValue(java.lang.String value)Sets the default value of this field.FieldBuilderformat(java.lang.String pattern)Sets the pattern used to format this field by the type handler.protected FieldConfiggetConfig()Returns the configuration settings.FieldBuilderignore()Indicates this field is not bound to a property of the class assigned to its parent record or segment.FieldBuilderkeepPadding()Indicates this field should not be unpadded during unmarshalling.FieldBuilderlength(int length)Sets the padded length of this field.FieldBuilderlenientPadding()Indicates the padding length should not be enforced for this field.FieldBuilderliteral(java.lang.String literal)Sets the literal text the field text must match.FieldBuildermaxLength(int n)Sets the maximum expected length of the field text.protected FieldBuilderme()Returns this.FieldBuilderminLength(int n)Sets the minimum expected length of the field text.FieldBuildernillable()Indicates this field is nillable for XML formatted streams.FieldBuilderoccursRef(java.lang.String ref)Indicates the number of occurrences of this field is governed by another field.FieldBuilderpadding(char c)Sets the character used to pad this field.FieldBuilderregex(java.lang.String pattern)Sets the regular expression the field text must match.FieldBuilderrequired()Indicates this field is required and must contain at least one character.FieldBuilderrid()Indicates this field is used to identify the record.FieldBuildertrim()Indicates the field text should be trimmed before validation and type conversion.FieldBuildertypeHandler(java.lang.Class<? extends TypeHandler> handler)Sets the type handler used for parsing and formatting field text.FieldBuildertypeHandler(java.lang.String name)Sets the type handler used for parsing and formatting field text.FieldBuildertypeHandler(TypeHandler handler)Sets the type handler used for parsing and formatting field text.FieldBuilderuntil(int until)Sets the maximum position of this field if it repeats an indeterminate number of times-
Methods inherited from class org.beanio.builder.PropertyBuilderSupport
collection, getter, lazy, maxOccurs, minOccurs, occurs, occurs, setter, type, xmlName, xmlNamespace, xmlPrefix, xmlType
-
-
-
-
Field Detail
-
config
protected FieldConfig config
-
-
Method Detail
-
me
protected FieldBuilder me()
Description copied from class:PropertyBuilderSupportReturns this.- Specified by:
mein classPropertyBuilderSupport<FieldBuilder>- Returns:
- this
-
getConfig
protected FieldConfig getConfig()
Description copied from class:PropertyBuilderSupportReturns the configuration settings.- Specified by:
getConfigin classPropertyBuilderSupport<FieldBuilder>- Returns:
- the configuration
-
rid
public FieldBuilder rid()
Indicates this field is used to identify the record.- Returns:
- this
-
at
public FieldBuilder at(int at)
Sets the position of the field.- Parameters:
at- the position- Returns:
- this
-
until
public FieldBuilder until(int until)
Sets the maximum position of this field if it repeats an indeterminate number of times- Parameters:
until- the maximum position- Returns:
- this
FieldBuilder
-
trim
public FieldBuilder trim()
Indicates the field text should be trimmed before validation and type conversion.- Returns:
- this
FieldBuilder
-
required
public FieldBuilder required()
Indicates this field is required and must contain at least one character.- Returns:
- this
FieldBuilder
-
occursRef
public FieldBuilder occursRef(java.lang.String ref)
Indicates the number of occurrences of this field is governed by another field.- Parameters:
ref- the name of the field that governs the occurrences of this field- Returns:
- this
FieldBuilder
-
minLength
public FieldBuilder minLength(int n)
Sets the minimum expected length of the field text.- Returns:
- this
FieldBuilder
-
maxLength
public FieldBuilder maxLength(int n)
Sets the maximum expected length of the field text.- Returns:
- this
FieldBuilder
-
regex
public FieldBuilder regex(java.lang.String pattern)
Sets the regular expression the field text must match.- Returns:
- this
FieldBuilder
-
literal
public FieldBuilder literal(java.lang.String literal)
Sets the literal text the field text must match.- Returns:
- this
FieldBuilder
-
defaultValue
public FieldBuilder defaultValue(java.lang.String value)
Sets the default value of this field.- Returns:
- this
FieldBuilder
-
format
public FieldBuilder format(java.lang.String pattern)
Sets the pattern used to format this field by the type handler.- Parameters:
pattern- the pattern- Returns:
- this
FieldBuilder
-
ignore
public FieldBuilder ignore()
Indicates this field is not bound to a property of the class assigned to its parent record or segment.- Returns:
- this
FieldBuilder
-
length
public FieldBuilder length(int length)
Sets the padded length of this field.- Parameters:
length- the length- Returns:
- this
FieldBuilder
-
padding
public FieldBuilder padding(char c)
Sets the character used to pad this field. Defaults to a space.- Parameters:
c- the padding character- Returns:
- this
FieldBuilder
-
keepPadding
public FieldBuilder keepPadding()
Indicates this field should not be unpadded during unmarshalling.- Returns:
- this
FieldBuilder
-
lenientPadding
public FieldBuilder lenientPadding()
Indicates the padding length should not be enforced for this field. Only applies to fixed length formatted streams.- Returns:
- this
FieldBuilder
-
align
public FieldBuilder align(Align align)
Sets the alignment or justification of this field if padded.- Parameters:
align- the alignment- Returns:
- this
FieldBuilder
-
nillable
public FieldBuilder nillable()
Indicates this field is nillable for XML formatted streams.- Returns:
- this
FieldBuilder
-
typeHandler
public FieldBuilder typeHandler(java.lang.String name)
Sets the type handler used for parsing and formatting field text.- Parameters:
name- the type handler name- Returns:
- this
FieldBuilder
-
typeHandler
public FieldBuilder typeHandler(java.lang.Class<? extends TypeHandler> handler)
Sets the type handler used for parsing and formatting field text.- Parameters:
handler- the type handler class- Returns:
- this
FieldBuilder
-
typeHandler
public FieldBuilder typeHandler(TypeHandler handler)
Sets the type handler used for parsing and formatting field text.- Parameters:
handler- theTypeHandler- Returns:
- this
FieldBuilder
-
build
public FieldConfig build()
Builds this field.- Returns:
- the field configuration
-
-