1 16 17 package org.apache.cocoon.components.elementprocessor.types; 18 19 import java.io.IOException ; 20 21 29 public class NumericResult 30 { 31 private Number _value; 32 private IOException _exception; 33 34 39 40 public NumericResult(final Number value) { 41 this(); 42 _value = value; 43 } 44 45 50 51 public NumericResult(final IOException exception) { 52 this(); 53 _exception = exception; 54 } 55 56 private NumericResult() { 57 _value = null; 58 _exception = null; 59 } 60 61 69 70 public int intValue() throws IOException { 71 return value().intValue(); 72 } 73 74 82 83 public double doubleValue() throws IOException { 84 return value().doubleValue(); 85 } 86 87 private Number value() throws IOException { 88 if (_exception != null) { 89 throw _exception; 90 } 91 return _value; 92 } 93 } | Popular Tags |