org.exolab.castor.builder.types
Class XSString

java.lang.Object
  extended by org.exolab.castor.builder.types.XSType
      extended by org.exolab.castor.builder.types.XSPatternBase
          extended by org.exolab.castor.builder.types.XSString

public final class XSString
extends XSPatternBase

The XML Schema String type

Version:
$Revision: 1.5 $ $Date: 2005/03/05 13:41:44 $
Author:
Keith Visco

Field Summary
 
Fields inherited from class org.exolab.castor.builder.types.XSType
ANYURI_NAME, ANYURI_TYPE, BASE64BINARY_NAME, BASE64BINARY_TYPE, BOOLEAN_NAME, BOOLEAN_TYPE, BYTE_NAME, BYTE_TYPE, CLASS, COLLECTION, DATE_NAME, DATE_TYPE, DATETIME_NAME, DATETIME_TYPE, DECIMAL_NAME, DECIMAL_TYPE, DOUBLE_NAME, DOUBLE_TYPE, DURATION_NAME, DURATION_TYPE, ENTITIES, ENTITY, FLOAT_NAME, FLOAT_TYPE, GDAY_NAME, GDAY_TYPE, GMONTH_NAME, GMONTH_TYPE, GMONTHDAY_NAME, GMONTHDAY_TYPE, GYEAR_NAME, GYEAR_TYPE, GYEARMONTH_NAME, GYEARMONTH_TYPE, HEXBINARY_NAME, HEXBINARY_TYPE, ID_NAME, ID_TYPE, IDREF_NAME, IDREF_TYPE, IDREFS_NAME, IDREFS_TYPE, INT_NAME, INT_TYPE, INTEGER_NAME, INTEGER_TYPE, LANGUAGE_NAME, LANGUAGE_TYPE, LONG_NAME, LONG_TYPE, NAME_NAME, NAME_TYPE, NCNAME_NAME, NCNAME_TYPE, NEGATIVE_INTEGER_NAME, NEGATIVE_INTEGER_TYPE, NMTOKEN_NAME, NMTOKEN_TYPE, NMTOKENS_NAME, NMTOKENS_TYPE, NON_NEGATIVE_INTEGER_NAME, NON_NEGATIVE_INTEGER_TYPE, NON_POSITIVE_INTEGER_NAME, NON_POSITIVE_INTEGER_TYPE, NORMALIZEDSTRING_NAME, NORMALIZEDSTRING_TYPE, NOTATION_NAME, NOTATION_TYPE, NULL, POSITIVE_INTEGER_NAME, POSITIVE_INTEGER_TYPE, QNAME_NAME, QNAME_TYPE, SHORT_NAME, SHORT_TYPE, STRING_NAME, STRING_TYPE, TIME_NAME, TIME_TYPE, TOKEN_NAME, TOKEN_TYPE
 
Constructor Summary
XSString()
          Creates a new XSString
 
Method Summary
 java.lang.String createFromJavaObjectCode(java.lang.String variableName)
          Returns the String necessary to convert an Object to an instance of this XSType.
 JType getJType()
          Returns the JType that this XSType represents
 int getLength()
          Returns the length that this type must have
 int getMaxLength()
          Returns the maximum length occurances of this type can be.
 int getMinLength()
          Returns the minimum length occurances of this type can be.
 java.lang.String getWhiteSpace()
          Returns the whiteSpace facet of this type
 boolean hasLength()
          Returns true if a length has been set
 boolean hasMaxLength()
          Returns true if a maximum length has been set
 boolean hasMinLength()
          Returns true if a minimum length has been set
 boolean hasWhiteSpace()
          Returns true if the whiteSpace facet is used
 void setFacets(SimpleType simpleType)
          Reads and sets the facets for XSType
 void setLength(int length)
          Sets the length of this XSString.
 void setMaxLength(int maxLength)
          Sets the maximum length of this XSString.
 void setMinLength(int minLength)
          Sets the minimum length of this XSString.
 void setWhiteSpace(java.lang.String value)
          Sets the whiteSpace facet of this XSString.
 void validationCode(JSourceCode jsc, java.lang.String fixedValue, java.lang.String fieldValidatorInstanceName)
          Creates the validation code for an instance of this XSType.
 
Methods inherited from class org.exolab.castor.builder.types.XSPatternBase
getPattern, setPattern
 
Methods inherited from class org.exolab.castor.builder.types.XSType
createToJavaObjectCode, escapePattern, getFacets, getName, getType, isDateTime, isEnumerated, isPrimitive, newInstanceCode, setAsEnumerated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSString

public XSString()
Creates a new XSString

Method Detail

createFromJavaObjectCode

public java.lang.String createFromJavaObjectCode(java.lang.String variableName)
Returns the String necessary to convert an Object to an instance of this XSType. This method is really only useful for primitive types

Overrides:
createFromJavaObjectCode in class XSType
Parameters:
variableName - the name of the Object
Returns:
the String necessary to convert an Object to an instance of this XSType

getJType

public JType getJType()
Returns the JType that this XSType represents

Specified by:
getJType in class XSType
Returns:
the JType that this XSType represents

getMaxLength

public int getMaxLength()
Returns the maximum length occurances of this type can be. A negative value denotes no maximum length

Returns:
the maximum length facet

getMinLength

public int getMinLength()
Returns the minimum length occurances of this type can be.

Returns:
the minimum length facet

getLength

public int getLength()
Returns the length that this type must have

Returns:
the length that this type must have

getWhiteSpace

public java.lang.String getWhiteSpace()
Returns the whiteSpace facet of this type

Returns:
the whiteSpace facet of this type

hasMaxLength

public boolean hasMaxLength()
Returns true if a maximum length has been set

Returns:
true if a maximum length has been set

hasMinLength

public boolean hasMinLength()
Returns true if a minimum length has been set

Returns:
true if a minimum length has been set

hasLength

public boolean hasLength()
Returns true if a length has been set

Returns:
true if a length has been set

hasWhiteSpace

public boolean hasWhiteSpace()
Returns true if the whiteSpace facet is used


setLength

public void setLength(int length)
Sets the length of this XSString. While setting the length, the maxLength and minLength are also set up to this length

Parameters:
length - the length to set
See Also:
setMaxLength(int), setMinLength(int)

setMaxLength

public void setMaxLength(int maxLength)
Sets the maximum length of this XSString. To remove the max length facet, use a negative value.

Parameters:
maxLength - the maximum length for occurances of this type

setMinLength

public void setMinLength(int minLength)
Sets the minimum length of this XSString.

Parameters:
minLength - the minimum length for occurances of this type

setWhiteSpace

public void setWhiteSpace(java.lang.String value)

Sets the whiteSpace facet of this XSString.

The value of the whiteSpace facet must be one of the following:

any other value will generate a Warning and set the whiteSpace to preserved

Parameters:
value - the whiteSpace value

setFacets

public void setFacets(SimpleType simpleType)
Description copied from class: XSType
Reads and sets the facets for XSType

Specified by:
setFacets in class XSType
Parameters:
simpleType - the SimpleType containing the facets

validationCode

public void validationCode(JSourceCode jsc,
                           java.lang.String fixedValue,
                           java.lang.String fieldValidatorInstanceName)
Creates the validation code for an instance of this XSType. The validation code should if necessary create a newly configured TypeValidator, that should then be added to a FieldValidator instance whose name is provided.

Specified by:
validationCode in class XSType
Parameters:
fixedValue - a fixed value to use if any
jsc - the JSourceCode to fill in.
fieldValidatorInstanceName - the name of the FieldValidator that the configured TypeValidator should be added to.


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com