1 16 17 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements; 18 19 import org.apache.cocoon.components.elementprocessor.types.NumericConverter; 20 import org.apache.cocoon.components.elementprocessor.types.NumericResult; 21 import org.apache.cocoon.components.elementprocessor.types.Validator; 22 23 import java.io.IOException ; 24 25 36 public class EP_Type extends BaseElementProcessor { 37 private NumericResult _type; 38 private static final Validator _validator = new Validator() 39 { 40 public IOException validate(final Number number) { 41 return GTKTypes.isValid(number.intValue()) ? null : 42 new IOException ("\"" + number + "\" is not a legal value"); 43 } 44 }; 45 46 49 public EP_Type() { 50 super(null); 51 _type = null; 52 } 53 54 59 int getType() throws IOException { 60 if (_type == null) { 61 _type = NumericConverter.extractInteger(getData(), _validator); 62 } 63 return _type.intValue(); 64 } 65 } | Popular Tags |