1 16 package org.apache.axis.types; 17 18 import org.apache.axis.utils.Messages; 19 20 28 public class NormalizedString extends Object implements java.io.Serializable { 29 30 String m_value = null; 32 public NormalizedString() { 33 super(); 34 } 35 36 42 public NormalizedString(String stValue) throws IllegalArgumentException { 43 setValue(stValue); 44 } 45 46 52 public void setValue(String stValue) throws IllegalArgumentException { 53 if (NormalizedString.isValid(stValue) == false) 54 throw new IllegalArgumentException ( 55 Messages.getMessage("badNormalizedString00") + 56 " data=[" + stValue + "]"); 57 m_value = stValue; 58 } 59 60 public String toString(){ 61 return m_value; 62 } 63 64 public int hashCode(){ 65 return m_value.hashCode(); 66 } 67 68 81 public static boolean isValid(String stValue) { 82 int scan; 83 84 for (scan = 0; scan < stValue.length(); scan++) { 85 char cDigit = stValue.charAt(scan); 86 switch (cDigit) { 87 case 0x09: 88 case 0x0A: 89 case 0x0D: 90 return false; 91 default: 92 break; 93 } 94 } 95 return true; 96 } 97 98 public boolean equals(Object object) { 99 String s1 = object.toString(); 100 return s1.equals(m_value); 101 } 102 } 103 | Popular Tags |