com.izforge.izpack.panels.userinput.field.rule
Class FieldSpec

java.lang.Object
  extended by com.izforge.izpack.panels.userinput.field.rule.FieldSpec

public class FieldSpec
extends Object

Rule field specification.

Author:
Elmar Grom, Tim Anderson

Nested Class Summary
static class FieldSpec.Type
          Field type.
 
Constructor Summary
FieldSpec(FieldSpec.Type type, int columns, int length)
          Creates a FieldSpec.
FieldSpec(String spec)
          Constructs a FieldSpec.
 
Method Summary
 int getColumns()
          Returns the number to columns to display.
 int getLength()
          Returns the maximum size of the field.
 FieldSpec.Type getType()
          Returns the field type.
 boolean isUnlimitedLength()
          Determines if the field has unlimited length.
static FieldSpec parse(String spec)
          Parses a field specification.
 boolean validate(String value)
          Validates a value against the field specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldSpec

public FieldSpec(String spec)
Constructs a FieldSpec.

Parameters:
spec - the field spec

FieldSpec

public FieldSpec(FieldSpec.Type type,
                 int columns,
                 int length)
Creates a FieldSpec.

Parameters:
type - the field type
columns - the number of columns to display.
length - the length of the field, or -1 if its unlimited
Method Detail

parse

public static FieldSpec parse(String spec)
Parses a field specification.

Parameters:
spec - the field specification
Returns:
the corresponding FieldSpec, or null if the spec is not a valid field specification

getType

public FieldSpec.Type getType()
Returns the field type.

Returns:
the field type

getColumns

public int getColumns()
Returns the number to columns to display.

Returns:
the number of columns to display

getLength

public int getLength()
Returns the maximum size of the field.

Returns:
the maximum size, or -1 if it is unlimited

isUnlimitedLength

public boolean isUnlimitedLength()
Determines if the field has unlimited length.

Returns:
true if the field has unlimited length, false if it is limited by getLength()

validate

public boolean validate(String value)
Validates a value against the field specification.

Parameters:
value - the value to validate
Returns:
true if the value is valid, otherwise false


Copyright © 2018. All rights reserved.