org.nuiton.wikitty.entities
Class FieldType

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

public class FieldType
extends Object
implements WikittyTagValue, Serializable

Version:
$Revision: 1463 $ Last update: $Date: 2012-04-05 18:08:38 +0200 (jeu, 05 avr 2012) $ by : $Author: bpoussin $
Author:
poussin
See Also:
Serialized Form

Field Summary
protected  int lowerBound
           
static int NOLIMIT
           
protected  WikittyTypes type
           
protected  int upperBound
           
 
Fields inherited from interface org.nuiton.wikitty.generator.WikittyTagValue
TAG_ALLOWED, TAG_ALLOWED_QUERY, TAG_ALTERNATIVE_NAME, TAG_CHOICE, TAG_CHOICE_QUERY, TAG_CRYPT, TAG_DOCUMENTATION, TAG_INDEXED, TAG_MAX, TAG_MAX_QUERY, TAG_MIN, TAG_MIN_QUERY, TAG_NOT_NULL, TAG_PATTERN, TAG_PRELOAD, TAG_SORT_ORDER, TAG_SUBTYPE, TAG_TO_STRING, TAG_UNIQUE, TAG_VERSION
 
Constructor Summary
FieldType()
           
FieldType(WikittyTypes type, int lowerBound, int upperBound)
           
 
Method Summary
 void addTagValue(String tag, String value)
           
 String getAllowed()
           
 List<String> getAllowedAsList()
           
 String getAllowedQuery()
           
 String getChoice()
           
 String getChoiceQuery()
           
 Object getContainedValidObject(Object value)
          Convert value in argument in right type for this FieldType.
 String getCryptAlgo()
           
 String getCryptPassword()
           
 int getLowerBound()
           
 String getMax()
           
 String getMaxQuery()
           
 String getMin()
           
 String getMinQuery()
           
 String getPattern()
           
 String getSubtype()
           
 Set<String> getTagNames()
           
 String getTagValue(String tag)
           
 Map<String,String> getTagValues()
           
 WikittyTypes getType()
           
 int getUpperBound()
           
 Object getValidValue(Object value)
          Return a valid value for this field.
 boolean hasAllowed()
           
 boolean hasAllowedQuery()
           
 boolean hasChoice()
           
 boolean hasChoiceQuery()
           
 boolean hasMax()
           
 boolean hasMaxQuery()
           
 boolean hasMin()
           
 boolean hasMinQuery()
           
 boolean hasPattern()
           
 boolean isCollection()
          Return true if this field have upperBound > 1.
 boolean isCrypted()
           
 boolean isIndexed()
           
 boolean isNotNull()
           
 boolean isRestrited()
          Si les extensions autorisees pour ce champs est contrainte par le tag value WikittyTagValue.TAG_ALLOWED alors retourne true, sinon false.
 boolean isUnique()
           
 boolean isValidValue(Object value)
          Test if value in argument is valid for this field type.
 void setLowerBound(int lowerBound)
           
 void setTagValues(Map<String,String> tagValues)
           
 void setType(WikittyTypes type)
           
 void setUpperBound(int upperBound)
           
 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

type

protected WikittyTypes type

lowerBound

protected int lowerBound

upperBound

protected int upperBound
Constructor Detail

FieldType

public FieldType()

FieldType

public FieldType(WikittyTypes 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

public 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 WikittyTypes getType()

setType

public void setType(WikittyTypes type)

getLowerBound

public int getLowerBound()

setLowerBound

public void setLowerBound(int lowerBound)

getUpperBound

public int getUpperBound()

setUpperBound

public void setUpperBound(int upperBound)

isUnique

public boolean isUnique()
See Also:
WikittyTagValue.TAG_UNIQUE

isNotNull

public boolean isNotNull()
See Also:
WikittyTagValue.TAG_NOT_NULL

isIndexed

public boolean isIndexed()
See Also:
WikittyTagValue.TAG_INDEXED

hasPattern

public boolean hasPattern()
See Also:
WikittyTagValue.TAG_PATTERN

getPattern

public String getPattern()
See Also:
WikittyTagValue.TAG_PATTERN

isCrypted

public boolean isCrypted()
See Also:
WikittyTagValue.TAG_CRYPT

getCryptAlgo

public String getCryptAlgo()
See Also:
WikittyTagValue.TAG_CRYPT

getCryptPassword

public String getCryptPassword()
Returns:
password or "" if general password must be used
See Also:
WikittyTagValue.TAG_CRYPT

getSubtype

public String getSubtype()
See Also:
WikittyTagValue.TAG_SUBTYPE

getAllowed

public String getAllowed()
See Also:
WikittyTagValue.TAG_ALLOWED

getAllowedQuery

public String getAllowedQuery()
See Also:
WikittyTagValue.TAG_ALLOWED_QUERY

getChoice

public String getChoice()
See Also:
WikittyTagValue.TAG_CHOICE

getChoiceQuery

public String getChoiceQuery()
See Also:
WikittyTagValue.TAG_CHOICE_QUERY

getMin

public String getMin()
See Also:
WikittyTagValue.TAG_MIN

getMinQuery

public String getMinQuery()
See Also:
WikittyTagValue.TAG_MIN_QUERY

getMax

public String getMax()
See Also:
WikittyTagValue.TAG_MAX

getMaxQuery

public String getMaxQuery()
See Also:
WikittyTagValue.TAG_MAX_QUERY

getAllowedAsList

public List<String> getAllowedAsList()
Returns:
list or null if not spcified allowed extension
See Also:
WikittyTagValue.TAG_ALLOWED

isRestrited

public boolean isRestrited()
Si les extensions autorisees pour ce champs est contrainte par le tag value WikittyTagValue.TAG_ALLOWED alors retourne true, sinon false.

See Also:
WikittyTagValue.TAG_ALLOWED

hasAllowed

public boolean hasAllowed()

hasAllowedQuery

public boolean hasAllowedQuery()

hasChoice

public boolean hasChoice()

hasChoiceQuery

public boolean hasChoiceQuery()

hasMin

public boolean hasMin()

hasMinQuery

public boolean hasMinQuery()

hasMax

public boolean hasMax()

hasMaxQuery

public boolean hasMaxQuery()


Copyright © 2009-2012 CodeLutin. All Rights Reserved.