You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/06/06 21:54:28 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/validators/datatype AbstractDatatypeValidator.java BinaryDatatypeValidator.java BooleanDatatypeValidator.java DatatypeValidatorFactoryImpl.java DecimalDatatypeValidator.java DoubleDatatypeValidator.java ENTITYDatatypeValidator.java FloatDatatypeValidator.java IDDatatypeValidator.java IDREFDatatypeValidator.java NOTATIONDatatypeValidator.java QNameDatatypeValidator.java RecurringDurationDatatypeValidator.java StringDatatypeValidator.java TimeDurationDatatypeValidator.java URIReferenceDatatypeValidator.java
jeffreyr 00/06/06 12:54:28
Modified: java/src/org/apache/xerces/validators/datatype
AbstractDatatypeValidator.java
BinaryDatatypeValidator.java
BooleanDatatypeValidator.java
DatatypeValidatorFactoryImpl.java
DecimalDatatypeValidator.java
DoubleDatatypeValidator.java
ENTITYDatatypeValidator.java
FloatDatatypeValidator.java
IDDatatypeValidator.java
IDREFDatatypeValidator.java
NOTATIONDatatypeValidator.java
QNameDatatypeValidator.java
RecurringDurationDatatypeValidator.java
StringDatatypeValidator.java
TimeDurationDatatypeValidator.java
URIReferenceDatatypeValidator.java
Log:
Need to Revisit architecture - added hack from Kento's to use clone
Revision Changes Path
1.3 +27 -12 xml-xerces/java/src/org/apache/xerces/validators/datatype/AbstractDatatypeValidator.java
Index: AbstractDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/AbstractDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractDatatypeValidator.java 2000/06/02 23:04:22 1.2
+++ AbstractDatatypeValidator.java 2000/06/06 19:54:24 1.3
@@ -57,7 +57,7 @@
/**
- * @version $Id: AbstractDatatypeValidator.java,v 1.2 2000/06/02 23:04:22 jeffreyr Exp $
+ * @version $Id: AbstractDatatypeValidator.java,v 1.3 2000/06/06 19:54:24 jeffreyr Exp $
* @author Jeffrey Rodriguez
*/
@@ -68,17 +68,23 @@
import org.apache.xerces.validators.datatype.DatatypeValidator;
-class AbstractDatatypeValidator implements DatatypeValidator {
+public abstract class AbstractDatatypeValidator implements DatatypeValidator, Cloneable {
private Hashtable fFacets; // Hashtable of Facets Strings.
- public AbstractDatatypeValidator(){
- }
- public AbstractDatatypeValidator ( DatatypeValidator base, Hashtable facets,
- boolean list ){
+ //abstract public AbstractDatatypeValidator();
+ //public AbstractDatatypeValidator(){
+ //}
- }
+ //abstract public AbstractDatatypeValidator ( DatatypeValidator base, Hashtable facets,
+ // boolean list );
+
+ //public AbstractDatatypeValidator ( DatatypeValidator base, Hashtable facets,
+ // boolean list ){
+ //
+ //
+ //}
/**
* Checks that "content" string is valid
@@ -96,10 +102,17 @@
* @exception InvalidDatatypeValueException
* @see org.apache.xerces.validators.datatype.InvalidDatatypeValueException
*/
- public Object validate(String content, Object state) throws InvalidDatatypeValueException{
- return null;
- }
+ abstract public Object validate(String content, Object state) throws InvalidDatatypeValueException;
+
+ //{
+ // System.out.println( "Here in AbstracDatatype " + content );
+ // return null;
+ //}
+
+ abstract public Object clone() throws CloneNotSupportedException ;
+
+
/**
* returns the datatype facet if any is set as a
* Hashtable
@@ -107,7 +120,7 @@
* @return
*/
public Hashtable getFacets() {
- return null;
+ return null; // Not implemented yet
}
/**
* Compares content in the Domain value vs. lexical
@@ -120,6 +133,8 @@
* @return
*/
public int compare(String value1, String valu2) {
- return 0;
+ return 0; //Not implemented yet
}
+
+
}
1.2 +11 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/BinaryDatatypeValidator.java
Index: BinaryDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/BinaryDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BinaryDatatypeValidator.java 2000/06/02 05:36:25 1.1
+++ BinaryDatatypeValidator.java 2000/06/06 19:54:24 1.2
@@ -73,7 +73,7 @@
*
* @author Ted Leung
* @author Jeffrey Rodriguez
- * @version $Id: BinaryDatatypeValidator.java,v 1.1 2000/06/02 05:36:25 jeffreyr Exp $
+ * @version $Id: BinaryDatatypeValidator.java,v 1.2 2000/06/06 19:54:24 jeffreyr Exp $
*/
public class BinaryDatatypeValidator extends AbstractDatatypeValidator {
@@ -221,6 +221,14 @@
return null;
}
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
//Private methods
/**
@@ -231,5 +239,7 @@
private void setBasetype(DatatypeValidator base) {
fBaseValidator = base;
}
+
+
}
1.2 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/BooleanDatatypeValidator.java
Index: BooleanDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/BooleanDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BooleanDatatypeValidator.java 2000/06/02 05:36:25 1.1
+++ BooleanDatatypeValidator.java 2000/06/06 19:54:24 1.2
@@ -70,7 +70,7 @@
*
* @author Ted Leung
* @author Jeffrey Rodriguez
- * @version $Id: BooleanDatatypeValidator.java,v 1.1 2000/06/02 05:36:25 jeffreyr Exp $
+ * @version $Id: BooleanDatatypeValidator.java,v 1.2 2000/06/06 19:54:24 jeffreyr Exp $
*/
public class BooleanDatatypeValidator extends AbstractDatatypeValidator {
@@ -173,6 +173,13 @@
return "Illegal Errorcode "+minor;
}
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
/**
* Checks content for validity.
1.2 +25 -16 xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java
Index: DatatypeValidatorFactoryImpl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DatatypeValidatorFactoryImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DatatypeValidatorFactoryImpl.java 2000/06/02 05:36:25 1.1
+++ DatatypeValidatorFactoryImpl.java 2000/06/06 19:54:24 1.2
@@ -66,7 +66,7 @@
/**
- * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.1 2000/06/02 05:36:25 jeffreyr Exp $
+ * @version $Id: DatatypeValidatorFactoryImpl.java,v 1.2 2000/06/06 19:54:24 jeffreyr Exp $
* @author Jeffrey Rodriguez
*/
@@ -284,20 +284,22 @@
DatatypeValidator base, Hashtable facets, boolean list ){
DatatypeValidator simpleType = null;
+
if ( base != null ) {
try {
+ Class validatorDef = base.getClass();
+
Class [] validatorArgsClass = new Class[] {
org.apache.xerces.validators.datatype.DatatypeValidator.class,
java.util.Hashtable.class,
boolean.class};
+
+
Object [] validatorArgs = new Object[] {
base, facets, new Boolean( list )};
- Class validatorDef =
- Class.forName(
- "org.apache.xerces.validators.datatype.AbstractDatatypeValidator" );
Constructor validatorConstructor =
@@ -308,9 +310,9 @@
( DatatypeValidator ) createDatatypeValidator (
validatorConstructor, validatorArgs );
+
addValidator( typeName, simpleType );//register validator
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
+
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
@@ -341,20 +343,27 @@
public DatatypeValidator getDatatypeValidator(String type) {
- DatatypeValidator simpleType = null;
+ AbstractDatatypeValidator simpleType = null;
if ( fRegistry.containsKey( type ) == true ) {
- simpleType = (DatatypeValidator) fRegistry.get(type);
- if ( simpleType != null ) {
+
+
+ simpleType = (AbstractDatatypeValidator) fRegistry.get(type);
+
+ if ( simpleType != null ) { // if not registered type to create one
try {
- simpleType = (DatatypeValidator) simpleType.getClass().newInstance();
- } catch ( InstantiationException e ) {
- e.printStackTrace();
- } catch ( IllegalAccessException e ) {
- e.printStackTrace();
- }
+ simpleType = (AbstractDatatypeValidator) simpleType.clone();
+ } catch (CloneNotSupportedException cloneExc) {
+ try {
+ simpleType = (AbstractDatatypeValidator) simpleType.getClass().newInstance();
+ } catch( InstantiationException e ) {
+ e.printStackTrace();
+ } catch( IllegalAccessException e ) {
+ e.printStackTrace();
+ }
+ }
}
}
- return simpleType;
+ return (DatatypeValidator) simpleType;
}
private void addValidator(String name, DatatypeValidator v) {
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/DecimalDatatypeValidator.java
Index: DecimalDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DecimalDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DecimalDatatypeValidator.java 2000/06/02 23:04:23 1.2
+++ DecimalDatatypeValidator.java 2000/06/06 19:54:24 1.3
@@ -71,7 +71,7 @@
*
* @author Ted Leung
* @author Jeffrey Rodriguez
- * @version $Id: DecimalDatatypeValidator.java,v 1.2 2000/06/02 23:04:23 jeffreyr Exp $
+ * @version $Id: DecimalDatatypeValidator.java,v 1.3 2000/06/06 19:54:24 jeffreyr Exp $
*/
public class DecimalDatatypeValidator extends AbstractDatatypeValidator {
@@ -301,6 +301,13 @@
return "Illegal Errorcode "+minor;
}
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
/*
public static void main(String args[]) {
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/DoubleDatatypeValidator.java
Index: DoubleDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/DoubleDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DoubleDatatypeValidator.java 2000/06/02 23:04:23 1.2
+++ DoubleDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -67,7 +67,7 @@
*
* @author Ted Leung
* @author Jeffrey Rodriguez
- * @version $Id: DoubleDatatypeValidator.java,v 1.2 2000/06/02 23:04:23 jeffreyr Exp $
+ * @version $Id: DoubleDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class DoubleDatatypeValidator extends AbstractDatatypeValidator {
@@ -299,6 +299,13 @@
public Hashtable getFacets(){
return null;
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
private String getErrorString(int major, int minor, Object args[]) {
1.2 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java
Index: ENTITYDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/ENTITYDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ENTITYDatatypeValidator.java 2000/06/02 05:36:25 1.1
+++ ENTITYDatatypeValidator.java 2000/06/06 19:54:25 1.2
@@ -66,7 +66,7 @@
* standalone code as well as plugins to the validator architecture.
*
* @author Jeffrey Rodriguez-
- * @version $Id: ENTITYDatatypeValidator.java,v 1.1 2000/06/02 05:36:25 jeffreyr Exp $
+ * @version $Id: ENTITYDatatypeValidator.java,v 1.2 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class ENTITYDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
@@ -117,6 +117,13 @@
}
// Private methods start here
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
/**
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/FloatDatatypeValidator.java
Index: FloatDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/FloatDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FloatDatatypeValidator.java 2000/06/02 23:04:23 1.2
+++ FloatDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -67,7 +67,7 @@
*
* @author Ted Leung
* @author Jeffrey Rodriguez
- * @version $Id: FloatDatatypeValidator.java,v 1.2 2000/06/02 23:04:23 jeffreyr Exp $
+ * @version $Id: FloatDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class FloatDatatypeValidator extends AbstractDatatypeValidator {
@@ -288,6 +288,13 @@
public Hashtable getFacets(){
return null;
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
private String getErrorString(int major, int minor, Object args[]) {
try {
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java
Index: IDDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IDDatatypeValidator.java 2000/06/02 23:04:24 1.2
+++ IDDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -65,7 +65,7 @@
* These validators can be supplied by the application writer and may be useful as
* standalone code as well as plugins to the validator architecture.
* @author Jeffrey Rodriguez
- * @version $Id: IDDatatypeValidator.java,v 1.2 2000/06/02 23:04:24 jeffreyr Exp $
+ * @version $Id: IDDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class IDDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
@@ -117,6 +117,13 @@
public Hashtable getFacets(){
return null;
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
/**
* Name of base type as a string.
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java
Index: IDREFDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IDREFDatatypeValidator.java 2000/06/02 23:04:24 1.2
+++ IDREFDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -66,7 +66,7 @@
* standalone code as well as plugins to the validator architecture.
*
* @author Jeffrey Rodriguez-
- * @version $Id: IDREFDatatypeValidator.java,v 1.2 2000/06/02 23:04:24 jeffreyr Exp $
+ * @version $Id: IDREFDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class IDREFDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
@@ -119,6 +119,13 @@
public Hashtable getFacets(){
return null;
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
/**
* Name of base type as a string.
* A Native datatype has the string "native" as its
1.2 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/NOTATIONDatatypeValidator.java
Index: NOTATIONDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/NOTATIONDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NOTATIONDatatypeValidator.java 2000/06/02 05:36:26 1.1
+++ NOTATIONDatatypeValidator.java 2000/06/06 19:54:25 1.2
@@ -66,7 +66,7 @@
* standalone code as well as plugins to the validator architecture.
*
* @author Jeffrey Rodriguez-
- * @version $Id: NOTATIONDatatypeValidator.java,v 1.1 2000/06/02 05:36:26 jeffreyr Exp $
+ * @version $Id: NOTATIONDatatypeValidator.java,v 1.2 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class NOTATIONDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
@@ -123,6 +123,13 @@
public int compare( String content1, String content2){
return -1;
}
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
/**
* Name of base type as a string.
* A Native datatype has the string "native" as its
1.2 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/QNameDatatypeValidator.java
Index: QNameDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/QNameDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QNameDatatypeValidator.java 2000/06/02 05:36:26 1.1
+++ QNameDatatypeValidator.java 2000/06/06 19:54:25 1.2
@@ -77,7 +77,7 @@
* XML].
*
* @author Jeffrey Rodriguez
- * @version $Id: QNameDatatypeValidator.java,v 1.1 2000/06/02 05:36:26 jeffreyr Exp $
+ * @version $Id: QNameDatatypeValidator.java,v 1.2 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class QNameDatatypeValidator extends AbstractDatatypeValidator {
private Locale fLocale = null;
@@ -366,6 +366,13 @@
return -1;
}
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/RecurringDurationDatatypeValidator.java
Index: RecurringDurationDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/RecurringDurationDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RecurringDurationDatatypeValidator.java 2000/06/02 23:04:24 1.2
+++ RecurringDurationDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -72,7 +72,7 @@
*
*
* @author Ted Leung, George Joseph, Jeffrey Rodriguez,
- * @version $Id: RecurringDurationDatatypeValidator.java,v 1.2 2000/06/02 23:04:24 jeffreyr Exp $
+ * @version $Id: RecurringDurationDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class RecurringDurationDatatypeValidator extends AbstractDatatypeValidator {
@@ -608,6 +608,13 @@
}
}
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
1.3 +45 -11 xml-xerces/java/src/org/apache/xerces/validators/datatype/StringDatatypeValidator.java
Index: StringDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/StringDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StringDatatypeValidator.java 2000/06/02 23:04:24 1.2
+++ StringDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -73,7 +73,7 @@
* @author Ted Leung
* @author Kito D. Mann, Virtua Communications Corp.
* @author Jeffrey Rodriguez
- * @version $Id: StringDatatypeValidator.java,v 1.2 2000/06/02 23:04:24 jeffreyr Exp $
+ * @version $Id: StringDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class StringDatatypeValidator extends AbstractDatatypeValidator{
private Locale fLocale = null;
@@ -100,15 +100,18 @@
public StringDatatypeValidator () throws InvalidDatatypeFacetException{
+ //System.out.println( "Inside constructor" );
this( null, null, false ); // Native, No Facets defined, Restriction
+
}
public StringDatatypeValidator ( DatatypeValidator base, Hashtable facets,
- boolean derivedByList ) throws InvalidDatatypeFacetException {
+ boolean derivedByList ) throws InvalidDatatypeFacetException {
setBasetype( base ); // Set base type
// Set Facets if any defined
+
if ( facets != null ){
if ( derivedByList == false) {
for (Enumeration e = facets.keys(); e.hasMoreElements();) {
@@ -167,10 +170,10 @@
if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both length and maxLength to be members of facets." );
+ "It is an error for both length and maxLength to be members of facets." );
} else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both length and minLength to be members of facets." );
+ "It is an error for both length and minLength to be members of facets." );
}
}
@@ -178,7 +181,7 @@
DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
if ( fMinLength < fMaxLength ) {
throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
- "must be greater that the value of maxLength" + fMaxLength );
+ "must be greater that the value of maxLength" + fMaxLength );
}
}
@@ -193,11 +196,11 @@
if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." );
+ "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype." );
}
if ( isMinExclusiveDefined && isMinInclusiveDefined ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both minInclusive and minExclusive to be specified for the same datatype." );
+ "It is an error for both minInclusive and minExclusive to be specified for the same datatype." );
}
} else { //derived by list
fDerivedByList = true;
@@ -240,10 +243,10 @@
if (((fFacetsDefined & DatatypeValidator.FACET_LENGTH ) != 0 ) ) {
if (((fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH ) != 0 ) ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both length and maxLength to be members of facets." );
+ "It is an error for both length and maxLength to be members of facets." );
} else if (((fFacetsDefined & DatatypeValidator.FACET_MINLENGTH ) != 0 ) ) {
throw new InvalidDatatypeFacetException(
- "It is an error for both length and minLength to be members of facets." );
+ "It is an error for both length and minLength to be members of facets." );
}
}
@@ -251,7 +254,7 @@
DatatypeValidator.FACET_MAXLENGTH) ) != 0 ) ) {
if ( fMinLength < fMaxLength ) {
throw new InvalidDatatypeFacetException( "Value of minLength = " + fMinLength +
- "must be greater that the value of maxLength" + fMaxLength );
+ "must be greater that the value of maxLength" + fMaxLength );
}
}
}
@@ -318,6 +321,8 @@
}
}
if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) != 0 ) {
+
+
if ( fEnumeration.contains( content ) == false )
throw new InvalidDatatypeValueException("Value '"+content+"' must be one of "+fEnumeration);
}
@@ -369,7 +374,36 @@
return collator.compare( content, facetValue );
}
-
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ StringDatatypeValidator newObj = null;
+ try {
+ newObj = new StringDatatypeValidator();
+
+ newObj.fLocale = this.fLocale;
+ newObj.fBaseValidator = this.fBaseValidator;
+ newObj.fLength = this.fLength;
+ newObj.fMaxLength = this.fMaxLength;
+ newObj.fMinLength = this.fMinLength;
+ newObj.fPattern = this.fPattern;
+ newObj.fEnumeration = this.fEnumeration;
+ newObj.fMaxInclusive = this.fMaxInclusive;
+ newObj.fMaxExclusive = this.fMaxExclusive;
+ newObj.fMinInclusive = this.fMinInclusive;
+ newObj.fMinExclusive = this.fMinExclusive;
+ newObj.fFacetsDefined = this.fFacetsDefined;
+ newObj.fDerivedByList = this.fDerivedByList;
+ newObj.isMaxExclusiveDefined = this.isMaxExclusiveDefined;
+ newObj.isMaxInclusiveDefined = this.isMaxInclusiveDefined;
+ newObj.isMinExclusiveDefined = this.isMinExclusiveDefined;
+ newObj.isMinInclusiveDefined = this.isMinInclusiveDefined;
+ } catch ( InvalidDatatypeFacetException ex) {
+ ex.printStackTrace();
+ }
+ return newObj;
+ }
// Private methods
private void checkContentList( String content )throws InvalidDatatypeValueException
1.3 +8 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/TimeDurationDatatypeValidator.java
Index: TimeDurationDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/TimeDurationDatatypeValidator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeDurationDatatypeValidator.java 2000/06/02 23:04:25 1.2
+++ TimeDurationDatatypeValidator.java 2000/06/06 19:54:25 1.3
@@ -72,7 +72,7 @@
* TimeDurationValidator validates that XML content is a W3C timeDuration.
*
* @author Ted Leung, George Joseph
- * @version $Id: TimeDurationDatatypeValidator.java,v 1.2 2000/06/02 23:04:25 jeffreyr Exp $
+ * @version $Id: TimeDurationDatatypeValidator.java,v 1.3 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class TimeDurationDatatypeValidator extends AbstractDatatypeValidator {
@@ -598,6 +598,13 @@
e.printStackTrace();
throw new InvalidDatatypeValueException("Unable to parse timeInstant "+e.toString());
}
+ }
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
}
1.2 +9 -1 xml-xerces/java/src/org/apache/xerces/validators/datatype/URIReferenceDatatypeValidator.java
Index: URIReferenceDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/URIReferenceDatatypeValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URIReferenceDatatypeValidator.java 2000/06/02 05:36:26 1.1
+++ URIReferenceDatatypeValidator.java 2000/06/06 19:54:25 1.2
@@ -74,7 +74,7 @@
* @author Jeffrey Rodriguez
* @see RFC 2396
* @see Tim Berners-Lee, et. al. RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax.. 1998 Available at: http://www.ietf.org/rfc/rfc2396.txt
- * @version $Id: URIReferenceDatatypeValidator.java,v 1.1 2000/06/02 05:36:26 jeffreyr Exp $
+ * @version $Id: URIReferenceDatatypeValidator.java,v 1.2 2000/06/06 19:54:25 jeffreyr Exp $
*/
public class URIReferenceDatatypeValidator extends AbstractDatatypeValidator {
private DatatypeValidator fBaseValidator = null;
@@ -271,6 +271,14 @@
public Hashtable getFacets(){
return null;
}
+
+ /**
+ * Returns a copy of this object.
+ */
+ public Object clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("clone() is not supported in "+this.getClass().getName());
+ }
+
// Private methods starts here