You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ha...@apache.org on 2003/06/30 19:33:39 UTC
cvs commit: xml-axis/java/src/org/apache/axis/types Id.java Language.java NCName.java NMToken.java Name.java NormalizedString.java Token.java UnsignedByte.java UnsignedInt.java UnsignedLong.java UnsignedShort.java
haddadc 2003/06/30 10:33:39
Modified: java/src/org/apache/axis/types Id.java Language.java
NCName.java NMToken.java Name.java
NormalizedString.java Token.java UnsignedByte.java
UnsignedInt.java UnsignedLong.java
UnsignedShort.java
Log:
PR: 19586
the isValid() methods of the types are now static, allowing greater re-use by app code.
Revision Changes Path
1.4 +15 -2 xml-axis/java/src/org/apache/axis/types/Id.java
Index: Id.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/Id.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Id.java 22 Apr 2003 19:35:59 -0000 1.3
+++ Id.java 30 Jun 2003 17:33:37 -0000 1.4
@@ -85,6 +85,19 @@
}
}
+ /**
+ *
+ * validates the data and sets the value for the object.
+ * @param Token String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (Id.isValid(stValue) == false)
+ throw new IllegalArgumentException(
+ Messages.getMessage("badIdType00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
/**
*
@@ -92,7 +105,7 @@
*
* Same validation as NCName for the time being
*/
- public boolean isValid(String stValue) {
- return super.isValid(stValue);
+ public static boolean isValid(String stValue) {
+ return NCName.isValid(stValue);
}
}
1.4 +1 -1 xml-axis/java/src/org/apache/axis/types/Language.java
Index: Language.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/Language.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Language.java 22 Apr 2003 19:35:59 -0000 1.3
+++ Language.java 30 Jun 2003 17:33:37 -0000 1.4
@@ -99,7 +99,7 @@
* Primary-tag = 1*8ALPHA
* Subtag = 1*8ALPHA
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
return true;
}
}
1.9 +14 -1 xml-axis/java/src/org/apache/axis/types/NCName.java
Index: NCName.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NCName.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NCName.java 22 Apr 2003 19:35:59 -0000 1.8
+++ NCName.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -89,6 +89,19 @@
}
}
+ /**
+ *
+ * validates the data and sets the value for the object.
+ * @param Token String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (NCName.isValid(stValue) == false)
+ throw new IllegalArgumentException(
+ Messages.getMessage("badNCNameType00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
/**
*
@@ -97,7 +110,7 @@
* NCName ::= (Letter | '_') (NCNameChar)*
* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
int scan;
boolean bValid = true;
1.9 +1 -1 xml-axis/java/src/org/apache/axis/types/NMToken.java
Index: NMToken.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NMToken.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NMToken.java 22 Apr 2003 19:36:00 -0000 1.8
+++ NMToken.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -96,7 +96,7 @@
* Nmtoken ::= (NameChar)+
* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
int scan;
for (scan=0; scan < stValue.length(); scan++) {
1.9 +14 -1 xml-axis/java/src/org/apache/axis/types/Name.java
Index: Name.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/Name.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Name.java 22 Apr 2003 19:36:00 -0000 1.8
+++ Name.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -89,6 +89,19 @@
}
}
+ /**
+ *
+ * validates the data and sets the value for the object.
+ * @param Name String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (Name.isValid(stValue) == false)
+ throw new IllegalArgumentException(
+ Messages.getMessage("badNameType00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
/**
*
@@ -96,7 +109,7 @@
* Name ::= (Letter | '_' | ':') ( NameChar)*
* NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
int scan;
boolean bValid = true;
1.9 +2 -2 xml-axis/java/src/org/apache/axis/types/NormalizedString.java
Index: NormalizedString.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/NormalizedString.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NormalizedString.java 5 May 2003 00:36:08 -0000 1.8
+++ NormalizedString.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -89,7 +89,7 @@
* @throws IllegalArgumentException if invalid format
*/
public void setValue(String stValue) throws IllegalArgumentException {
- if (isValid(stValue) == false)
+ if (NormalizedString.isValid(stValue) == false)
throw new IllegalArgumentException(
Messages.getMessage("badNormalizedString00") +
" data=[" + stValue + "]");
@@ -117,7 +117,7 @@
* @param the String to test
* @returns true if valid normalizedString
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
int scan;
for (scan = 0; scan < stValue.length(); scan++) {
1.9 +16 -1 xml-axis/java/src/org/apache/axis/types/Token.java
Index: Token.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/Token.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Token.java 2 May 2003 19:55:19 -0000 1.8
+++ Token.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -99,7 +99,7 @@
* trailing spaces (#x20) and that have no internal sequences of two
* or more spaces.
*/
- public boolean isValid(String stValue) {
+ public static boolean isValid(String stValue) {
int scan;
// check to see if we have a string to review
if ( (stValue == null) || (stValue.length() == 0) )
@@ -131,4 +131,19 @@
}
return true;
}
+
+ /**
+ *
+ * validates the data and sets the value for the object.
+ * @param Token String value
+ * @throws IllegalArgumentException if invalid format
+ */
+ public void setValue(String stValue) throws IllegalArgumentException {
+ if (Token.isValid(stValue) == false)
+ throw new IllegalArgumentException(
+ Messages.getMessage("badToken00") +
+ " data=[" + stValue + "]");
+ m_value = stValue;
+ }
+
}
1.9 +2 -2 xml-axis/java/src/org/apache/axis/types/UnsignedByte.java
Index: UnsignedByte.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedByte.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UnsignedByte.java 22 Apr 2003 19:36:00 -0000 1.8
+++ UnsignedByte.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -89,7 +89,7 @@
* @param sValue the number to set
*/
public void setValue(long sValue) throws NumberFormatException {
- if (isValid(sValue) == false)
+ if (UnsignedByte.isValid(sValue) == false)
throw new NumberFormatException(
Messages.getMessage("badUnsignedByte00") +
String.valueOf(sValue) + "]");
@@ -101,7 +101,7 @@
* validate the value against the xsd value space definition
* @param sValue number to check against range
*/
- public boolean isValid(long sValue) {
+ public static boolean isValid(long sValue) {
if ( (sValue < 0L ) || (sValue > 255L) )
return false;
else
1.10 +2 -2 xml-axis/java/src/org/apache/axis/types/UnsignedInt.java
Index: UnsignedInt.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedInt.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UnsignedInt.java 22 Apr 2003 19:36:00 -0000 1.9
+++ UnsignedInt.java 30 Jun 2003 17:33:37 -0000 1.10
@@ -91,7 +91,7 @@
* @param int value
*/
public void setValue(long iValue) throws NumberFormatException {
- if (isValid(iValue) == false)
+ if (UnsignedInt.isValid(iValue) == false)
throw new NumberFormatException(
Messages.getMessage("badUnsignedInt00") +
String.valueOf(iValue) + "]");
@@ -117,7 +117,7 @@
* validate the value against the xsd definition
*
*/
- public boolean isValid(long iValue) {
+ public static boolean isValid(long iValue) {
if ( (iValue < 0L) || (iValue > 4294967295L))
return false;
else
1.11 +2 -2 xml-axis/java/src/org/apache/axis/types/UnsignedLong.java
Index: UnsignedLong.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedLong.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- UnsignedLong.java 22 Apr 2003 19:36:00 -0000 1.10
+++ UnsignedLong.java 30 Jun 2003 17:33:37 -0000 1.11
@@ -92,7 +92,7 @@
* @param long value
*/
public void setValue(double lValue) throws NumberFormatException {
- if (isValid(lValue) == false)
+ if (UnsignedLong.isValid(lValue) == false)
throw new NumberFormatException(
Messages.getMessage("badUnsignedLong00") +
String.valueOf(lValue) + "]");
@@ -130,7 +130,7 @@
* validate the value against the xsd definition
*
*/
- public boolean isValid(double lValue) {
+ public static boolean isValid(double lValue) {
if ( (lValue < 0L) || (lValue > 18446744073709551615D) )
return false;
else
1.9 +2 -2 xml-axis/java/src/org/apache/axis/types/UnsignedShort.java
Index: UnsignedShort.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/types/UnsignedShort.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UnsignedShort.java 22 Apr 2003 19:36:01 -0000 1.8
+++ UnsignedShort.java 30 Jun 2003 17:33:37 -0000 1.9
@@ -87,7 +87,7 @@
* @param short value
*/
public void setValue(long sValue) throws NumberFormatException {
- if (isValid(sValue) == false)
+ if (UnsignedShort.isValid(sValue) == false)
throw new NumberFormatException(
Messages.getMessage("badUnsignedShort00") +
String.valueOf(sValue) + "]");
@@ -99,7 +99,7 @@
* validate the value against the xsd definition
*
*/
- public boolean isValid(long sValue) {
+ public static boolean isValid(long sValue) {
if ( (sValue < 0L ) || (sValue > 65535L) )
return false;
else