1 16 package org.apache.axis.types; 17 18 import org.apache.axis.utils.Messages; 19 20 26 public class UnsignedShort extends UnsignedInt { 27 28 public UnsignedShort() { 29 30 } 31 32 36 public UnsignedShort(long sValue) throws NumberFormatException { 37 setValue(sValue); 38 } 39 40 public UnsignedShort(String sValue) throws NumberFormatException { 41 setValue(Long.parseLong(sValue)); 42 } 43 44 50 public void setValue(long sValue) throws NumberFormatException { 51 if (UnsignedShort.isValid(sValue) == false) 52 throw new NumberFormatException ( 53 Messages.getMessage("badUnsignedShort00") + 54 String.valueOf(sValue) + "]"); 55 lValue = new Long (sValue); 56 } 57 58 63 public static boolean isValid(long sValue) { 64 if ( (sValue < 0L ) || (sValue > 65535L) ) 65 return false; 66 else 67 return true; 68 } 69 70 } 71 | Popular Tags |