org.sharengo.wikitty
Class FieldType

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

public class FieldType
extends Object
implements Serializable

Version:
$Revision: 1 $ Last update: $Date: 2010-04-16 10:29:38 +0200 (ven., 16 avril 2010) $ by : $Author: echatellier $
Author:
poussin
See Also:
Serialized Form

Nested Class Summary
static class FieldType.TYPE
           
 
Field Summary
static int NOLIMIT
           
 
Constructor Summary
FieldType()
           
FieldType(FieldType.TYPE type, int lowerBound, int upperBound)
           
FieldType(FieldType.TYPE type, int lowerBound, int upperBound, boolean unique, boolean notNull)
           
 
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 valide 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

NOLIMIT

public static final int NOLIMIT
See Also:
Constant Field Values
Constructor Detail

FieldType

public FieldType()

FieldType

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

FieldType

public FieldType(FieldType.TYPE type,
                 int lowerBound,
                 int upperBound,
                 boolean unique,
                 boolean notNull)
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:

toDefinition

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

Parameters:
name - field name used for definition
Returns:

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:
Throws:
WikittyException

isValidValue

public boolean isValidValue(Object value)
test if value in argument is valide 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.