org.nuiton.wikitty
Class FieldType

java.lang.Object
  extended by org.nuiton.wikitty.FieldType
All Implemented Interfaces:
Serializable

public class FieldType
extends Object
implements Serializable

Version:
$Revision: 217 $ Last update: $Date: 2010-08-03 11:48:17 +0200 (mar., 03 août 2010) $ by : $Author: bleny $
Author:
poussin
See Also:
Serialized Form

Nested Class Summary
static class FieldType.TYPE
           
 
Field Summary
protected  int lowerBound
           
static int NOLIMIT
           
static String NOT_NULL
          tag/value use for not null
protected  FieldType.TYPE type
           
static String UNIQUE
          tag/value use for unique
protected  int upperBound
           
 
Constructor Summary
FieldType()
           
FieldType(FieldType.TYPE type, int lowerBound, int upperBound)
           
 
Method Summary
 void addTagValue(String tag, String value)
           
protected  Object getContainedValidObject(Object value)
          Convert value in argument in right type for this FieldType.
 int getLowerBound()
           
 Set<String> getTagNames()
           
 String getTagValue(String tag)
           
 Map<String,String> getTagValues()
           
 FieldType.TYPE getType()
           
 int getUpperBound()
           
 Object getValidValue(Object value)
          Return a valid value for this field.
 boolean isCollection()
          Return true if this field have upperBound > 1.
 boolean isNotNull()
           
 boolean isUnique()
           
 boolean isValidValue(Object value)
          Test if value in argument is valid for this field type.
 void setTagValues(Map<String,String> tagValues)
           
 String toDefinition(String name)
          Return string definition for this field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIQUE

public static String UNIQUE
tag/value use for unique


NOT_NULL

public static String NOT_NULL
tag/value use for not null


NOLIMIT

public static final int NOLIMIT
See Also:
Constant Field Values

type

protected FieldType.TYPE type

lowerBound

protected int lowerBound

upperBound

protected int upperBound
Constructor Detail

FieldType

public FieldType()

FieldType

public FieldType(FieldType.TYPE type,
                 int lowerBound,
                 int upperBound)
Method Detail

addTagValue

public void addTagValue(String tag,
                        String value)

getTagValue

public String getTagValue(String tag)

getTagNames

public Set<String> getTagNames()

getTagValues

public Map<String,String> getTagValues()

setTagValues

public void setTagValues(Map<String,String> tagValues)

isCollection

public boolean isCollection()
Return true if this field have upperBound > 1.

Returns:
true is field is collection

toDefinition

public String toDefinition(String name)
Return string definition for this field.

Parameters:
name - field name used for definition
Returns:
field definition

getContainedValidObject

protected Object getContainedValidObject(Object value)
Convert value in argument in right type for this FieldType. Don't support collection.

Parameters:
value - value to convert
Returns:
object in type of this FieldType

getValidValue

public Object getValidValue(Object value)
                     throws WikittyException
Return a valid value for this field.

Parameters:
value - is casted if possible to an actual correct value.
Returns:
value validity
Throws:
WikittyException - if value can't be obtained

isValidValue

public boolean isValidValue(Object value)
Test if value in argument is valid for this field type.

Parameters:
value - to test
Returns:
true if value is valid

getType

public FieldType.TYPE getType()

getLowerBound

public int getLowerBound()

getUpperBound

public int getUpperBound()

isUnique

public boolean isUnique()

isNotNull

public boolean isNotNull()


Copyright © 2009-2010 CodeLutin. All Rights Reserved.