1 55 package org.jboss.axis.types; 56 57 import org.jboss.axis.utils.Messages; 58 59 67 public class NormalizedString 68 { 69 String m_value = null; 71 public NormalizedString() 72 { 73 super(); 74 } 75 76 82 public NormalizedString(String stValue) throws IllegalArgumentException 83 { 84 setValue(stValue); 85 } 86 87 93 public void setValue(String stValue) throws IllegalArgumentException 94 { 95 if (isValid(stValue) == false) 96 throw new IllegalArgumentException (Messages.getMessage("badNormalizedString00") + 97 " data=[" + stValue + "]"); 98 m_value = stValue; 99 } 100 101 public String toString() 102 { 103 return m_value; 104 } 105 106 public int hashCode() 107 { 108 return m_value.hashCode(); 109 } 110 111 123 public boolean isValid(String stValue) 124 { 125 int scan; 126 127 for (scan = 0; scan < stValue.length(); scan++) 128 { 129 char cDigit = stValue.charAt(scan); 130 switch (cDigit) 131 { 132 case 0x09: 133 case 0x0A: 134 case 0x0D: 135 return false; 136 default: 137 break; 138 } 139 } 140 return true; 141 } 142 143 public boolean equals(Object object) 144 { 145 String s1 = object.toString(); 146 return s1.equals(m_value); 147 } 148 } 149 | Popular Tags |