org.sakaiproject.metaobj.utils.xml.impl
Class BaseElementType

java.lang.Object
  extended byorg.sakaiproject.metaobj.utils.xml.impl.BaseElementType
All Implemented Interfaces:
ElementType
Direct Known Subclasses:
BooleanElementType, FormatterElementType, UriElementType

public class BaseElementType
extends Object
implements ElementType

Created by IntelliJ IDEA. User: John Ellis Date: Apr 15, 2004 Time: 5:07:44 PM To change this template use File | Settings | File Templates.


Field Summary
protected  String defaultValue
           
protected  String fixedValue
           
protected  int length
           
protected  int maxLength
           
protected  int minLength
           
protected  SchemaNode parentNode
           
protected  Pattern pattern
           
protected  org.jdom.Element schemaElement
           
protected static int WHITE_SPACE_TYPE_COLLAPSE
           
protected static int WHITE_SPACE_TYPE_NONE
           
protected static int WHITE_SPACE_TYPE_PRESERVE
           
protected static int WHITE_SPACE_TYPE_REPLACE
           
protected  int whiteSpaceType
           
 
Constructor Summary
BaseElementType(String typeName, org.jdom.Element schemaElement, SchemaNode parentNode, org.jdom.Namespace xsdNamespace)
           
 
Method Summary
 Object getActualNormalizedValue(String value)
           
 String getBaseType()
           
 String getDefaultValue()
           
 List getEnumeration()
           
 String getFixedValue()
           
 int getLength()
           
 int getMaxLength()
           
 int getMinLength()
           
 Class getObjectType()
           
 Pattern getPattern()
           
 ValueRange getRange()
           
 String getSchemaNormalizedValue(Object value)
           
 String getSchemaNormalizedValue(String value)
           
 int getWhiteSpaceType()
           
protected  void init(org.jdom.Namespace xsdNamespace)
           
 BaseElementType postInit(org.jdom.Namespace xsdNamespace)
           
protected  void processEnumerations(org.jdom.Element restrictions, org.jdom.Namespace xsdNamespace)
           
protected  int processIntRestriction(org.jdom.Element restrictions, String s, org.jdom.Namespace xsdNamespace, int defaultValue)
           
protected  String processStringRestriction(org.jdom.Element restrictions, String s, org.jdom.Namespace xsdNamespace)
           
 void setBaseType(String baseType)
           
 ValidatedNode validateAndNormalize(org.jdom.Attribute node)
           
 ValidatedNode validateAndNormalize(org.jdom.Element node)
          Validates the passed in node and all children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE_SPACE_TYPE_NONE

protected static final int WHITE_SPACE_TYPE_NONE
See Also:
Constant Field Values

WHITE_SPACE_TYPE_PRESERVE

protected static final int WHITE_SPACE_TYPE_PRESERVE
See Also:
Constant Field Values

WHITE_SPACE_TYPE_REPLACE

protected static final int WHITE_SPACE_TYPE_REPLACE
See Also:
Constant Field Values

WHITE_SPACE_TYPE_COLLAPSE

protected static final int WHITE_SPACE_TYPE_COLLAPSE
See Also:
Constant Field Values

length

protected int length

maxLength

protected int maxLength

minLength

protected int minLength

pattern

protected Pattern pattern

whiteSpaceType

protected int whiteSpaceType

defaultValue

protected String defaultValue

fixedValue

protected String fixedValue

schemaElement

protected org.jdom.Element schemaElement

parentNode

protected SchemaNode parentNode
Constructor Detail

BaseElementType

public BaseElementType(String typeName,
                       org.jdom.Element schemaElement,
                       SchemaNode parentNode,
                       org.jdom.Namespace xsdNamespace)
Method Detail

init

protected void init(org.jdom.Namespace xsdNamespace)

processEnumerations

protected void processEnumerations(org.jdom.Element restrictions,
                                   org.jdom.Namespace xsdNamespace)

processStringRestriction

protected String processStringRestriction(org.jdom.Element restrictions,
                                          String s,
                                          org.jdom.Namespace xsdNamespace)

processIntRestriction

protected int processIntRestriction(org.jdom.Element restrictions,
                                    String s,
                                    org.jdom.Namespace xsdNamespace,
                                    int defaultValue)

validateAndNormalize

public ValidatedNode validateAndNormalize(org.jdom.Element node)
Validates the passed in node and all children. Will also normalize any values.

Parameters:
node - a jdom element to validate
Returns:
the validated Element wrapped in a ValidatedNode class

getSchemaNormalizedValue

public String getSchemaNormalizedValue(Object value)
                                throws NormalizationException
Throws:
NormalizationException

getSchemaNormalizedValue

public String getSchemaNormalizedValue(String value)
                                throws NormalizationException
Throws:
NormalizationException

getObjectType

public Class getObjectType()
Specified by:
getObjectType in interface ElementType

getActualNormalizedValue

public Object getActualNormalizedValue(String value)

getLength

public int getLength()
Specified by:
getLength in interface ElementType

getMaxLength

public int getMaxLength()
Specified by:
getMaxLength in interface ElementType

getMinLength

public int getMinLength()
Specified by:
getMinLength in interface ElementType

getPattern

public Pattern getPattern()
Specified by:
getPattern in interface ElementType
Returns:
A regular expression that expresses a constraint on legal value(s) for the element.

getRange

public ValueRange getRange()
Specified by:
getRange in interface ElementType
Returns:
ValueRange object describing the type's range. Objects within this range will be of the class getObjectType(). This is null if there is no restriction on the value's range

getWhiteSpaceType

public int getWhiteSpaceType()

getDefaultValue

public String getDefaultValue()
Specified by:
getDefaultValue in interface ElementType

getFixedValue

public String getFixedValue()
Specified by:
getFixedValue in interface ElementType

getEnumeration

public List getEnumeration()
Specified by:
getEnumeration in interface ElementType

postInit

public BaseElementType postInit(org.jdom.Namespace xsdNamespace)

validateAndNormalize

public ValidatedNode validateAndNormalize(org.jdom.Attribute node)

getBaseType

public String getBaseType()
Specified by:
getBaseType in interface ElementType
Returns:
the base xml type of the associated node

setBaseType

public void setBaseType(String baseType)