org.exolab.castor.builder.types

Class AbstractWhiteSpaceFacet

Known Direct Subclasses:
AbstractLengthFacet, AbstractRangeFacet, XSBoolean

public abstract class AbstractWhiteSpaceFacet
extends AbstractPatternFacet

A base class for types which support the whiteSpace and pattern facets.
Version:
$Revision: 6678 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
Author:
Ralf Joachim
Since:
1.1

Field Summary

Fields inherited from class org.exolab.castor.builder.types.XSType

ANYURI_TYPE, BASE64BINARY_TYPE, BOOLEAN_TYPE, BYTE_TYPE, CLASS, COLLECTION, DATETIME_TYPE, DATE_TYPE, DECIMAL_TYPE, DOUBLE_TYPE, DURATION_TYPE, ENTITIES, ENTITY, FLOAT_TYPE, GDAY_TYPE, GMONTHDAY_TYPE, GMONTH_TYPE, GYEARMONTH_TYPE, GYEAR_TYPE, HEXBINARY_TYPE, IDREFS_TYPE, IDREF_TYPE, ID_TYPE, INTEGER_TYPE, INT_TYPE, LANGUAGE_TYPE, LONG_TYPE, NAME_TYPE, NCNAME_TYPE, NEGATIVE_INTEGER_TYPE, NMTOKENS_TYPE, NMTOKEN_TYPE, NON_NEGATIVE_INTEGER_TYPE, NON_POSITIVE_INTEGER_TYPE, NORMALIZEDSTRING_TYPE, NOTATION_TYPE, NULL, POSITIVE_INTEGER_TYPE, QNAME_TYPE, SHORT_TYPE, STRING_TYPE, TIME_TYPE, TOKEN_TYPE, UNSIGNED_BYTE_TYPE, UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE

Constructor Summary

AbstractWhiteSpaceFacet()
No-arg constructor.
AbstractWhiteSpaceFacet(boolean whiteSpaceCollapseOnly)
Construct a new AbstractXSPatternFacet optionally allowing the whiteSpace facet to be set to 'replace' and 'preserve' values in addition to 'collaps'.

Method Summary

protected void
codeWhiteSpaceFacet(JSourceCode jsc, String validatorName)
Generate the source code for pattern facet validation.
String
getWhiteSpace()
Returns the whiteSpace facet of this type.
boolean
hasWhiteSpace()
Returns true if the whiteSpace facet is used.
protected void
setFacet(Facet facet)
void
setWhiteSpace(String value)
Sets the whiteSpace facet of this XSType.
protected void
setWhiteSpaceFacet(Facet facet)
Transfer given facet if it is a whiteSpace.

Methods inherited from class org.exolab.castor.builder.types.AbstractPatternFacet

addPattern, addPatternFacet, codePatternFacet, getPatterns

Methods inherited from class org.exolab.castor.builder.types.XSType

createDefaultValueWithString, createFromJavaObjectCode, createToJavaObjectCode, getJType, getName, getType, isCollection, isDateTime, isEnumerated, isPrimitive, newInstanceCode, setAsEnumerated, setFacet, setFacets, validationCode

Constructor Details

AbstractWhiteSpaceFacet

protected AbstractWhiteSpaceFacet()
No-arg constructor. By default only 'collapse' is supported for the whiteSpace facet.

AbstractWhiteSpaceFacet

protected AbstractWhiteSpaceFacet(boolean whiteSpaceCollapseOnly)
Construct a new AbstractXSPatternFacet optionally allowing the whiteSpace facet to be set to 'replace' and 'preserve' values in addition to 'collaps'.
Parameters:
whiteSpaceCollapseOnly - If set to true only 'collapse' is allowed for the whiteSpace facet. If set to false 'collaps', 'replace' and 'preserve' values are allowed for whiteSpace facet.

Method Details

codeWhiteSpaceFacet

protected final void codeWhiteSpaceFacet(JSourceCode jsc,
                                         String validatorName)
Generate the source code for pattern facet validation.
Parameters:
jsc - The JSourceCode to fill in.
validatorName - The name of the TypeValidator that the whiteSpace should be added to.

getWhiteSpace

public final String getWhiteSpace()
Returns the whiteSpace facet of this type.
Returns:
The whiteSpace facet of this type.

hasWhiteSpace

public final boolean hasWhiteSpace()
Returns true if the whiteSpace facet is used.
Returns:
True if the whiteSpace facet is used.

setFacet

protected void setFacet(Facet facet)
Overrides:
setFacet in interface XSType

setWhiteSpace

public final void setWhiteSpace(String value)
Sets the whiteSpace facet of this XSType. The value of the whiteSpace facet must be one of the following:
  • preserve
  • replace
  • collapse
Any other value will generate a warning and the whiteSpace facet keeps unchanged.
Parameters:
value - The value for the whiteSpace facet.

setWhiteSpaceFacet

protected final void setWhiteSpaceFacet(Facet facet)
Transfer given facet if it is a whiteSpace.
Parameters:
facet - The facet to transfer.

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