1 17 package org.apache.ws.jaxme.generator.sg.impl; 18 19 import org.apache.ws.jaxme.generator.sg.Facet; 20 import org.apache.ws.jaxme.xs.XSEnumeration; 21 import org.apache.ws.jaxme.xs.XSType; 22 23 26 public class FacetImpl implements Facet { 27 private final Facet.Type type; 28 private final String [] values; 29 private final String value; 30 private final Long numValue; 31 32 34 public FacetImpl(XSType pType, XSEnumeration[] pEnumerations) { 35 type = Facet.ENUMERATION; 36 values = new String [pEnumerations.length]; 37 for (int i = 0; i < pEnumerations.length; i++) { 38 values[i] = pEnumerations[i].getValue(); 39 } 40 value = null; 41 numValue = null; 42 } 43 44 public Type getType() { return type; } 45 public String [] getValues() { 46 if (values == null) { 47 throw new IllegalStateException ("The facet type " + type + " doesn't support the getValues() method."); 48 } 49 return values; 50 } 51 52 public String getValue() { 53 if (value == null) { 54 throw new IllegalStateException ("The facet type " + type + " doesn't support the getValue() method."); 55 } 56 return value; 57 } 58 59 public long getNumValue() { 60 if (numValue == null) { 61 throw new IllegalStateException ("The facet type " + type + " doesn't support the getNumValue() method."); 62 } 63 return numValue.longValue(); 64 } 65 } 66 | Popular Tags |