1 22 23 24 package org.xquark.xquery.parser; 25 26 import org.xquark.xquery.typing.TypeException; 27 28 29 public class ValueInteger extends Value implements Cloneable { 30 private static final String RCSRevision = "$Revision: 1.7 $"; 31 private static final String RCSName = "$Name: $"; 32 33 34 38 public void accept(ParserVisitor visitor) throws XQueryException { 39 visitor.visit(this); 40 } 41 42 46 public ValueInteger(String value, XQueryModule parentModule) throws TypeException, XQueryException { 47 super(value); 48 setValue(value); 49 setParentModule(parentModule); 50 if (parentModule != null && parentModule.getStaticContext().getTypeVisitor() != null) 51 accept(parentModule.getStaticContext().getTypeVisitor()); 52 } 53 54 58 public Integer getIntValue() { return new Integer (value); } 59 public Object getObjectValue() { return getIntValue(); } 60 public void setValue(String value) throws XQueryException { 61 try { 63 Integer.parseInt(value); 64 } 65 catch (NumberFormatException e) { 66 throw new XQueryException("value of valueInteger must be a valid Integer"); 67 } 68 this.value = value; 69 } 70 public void setValue(int value) throws XQueryException { 71 setValue(String.valueOf(value)); 72 } 73 74 } 75 | Popular Tags |