Package org.apache.ws.jaxme.js.impl

Examples of org.apache.ws.jaxme.js.impl.TypedValueImpl


  protected String getDatatypeName() { return "Short"; }
  protected JavaQName getDatatypeType() { return SHORT_TYPE; }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    try {
      return new TypedValueImpl(new Object[]{"((", SHORT_TYPE, ")", new Short(new DatatypeConverterImpl().parseShort(pValue)), ")"},
                  SHORT_TYPE);
    } catch (NumberFormatException e) {
      throw new LocSAXException("Failed to convert string value to short: " + pValue, getLocator());
    }
  }
View Full Code Here


  protected String getDatatypeName() { return "Int"; }
  protected JavaQName getDatatypeType() { return INT_TYPE; }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    try {
      return new TypedValueImpl(new Integer(new DatatypeConverterImpl().parseInt(pValue)), INT_TYPE);
    } catch (NumberFormatException e) {
      Locator locator;
      try {
        locator = getLocator();
      } catch (Exception f) {
View Full Code Here

  public JavaQName getPrimitiveRuntimeType(SimpleTypeSG pController) { return BOOLEAN_TYPE; }
  protected JavaQName getObjectRuntimeType(SimpleTypeSG pController) { return BOOLEAN_OBJECT_TYPE; }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    try {
      return new TypedValueImpl(new DatatypeConverterImpl().parseBoolean(pValue) ? Boolean.TRUE : Boolean.FALSE,
                  BOOLEAN_OBJECT_TYPE);
    } catch (RuntimeException e) {
      throw new LocSAXException("Failed to convert string value to boolean: " + pValue, getLocator());
    }
  }
View Full Code Here

  protected String getDatatypeName() { return "HexBinary"; }
  protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    try {
      return new TypedValueImpl(new DatatypeConverterImpl().parseHexBinary(pValue), BYTE_ARRAY_TYPE);
    } catch (NumberFormatException e) {
      throw new LocSAXException("Failed to convert string value to HexBinary: " + pValue, getLocator());
    }
  }
View Full Code Here

  protected String getDatatypeName() { return "Base64Binary"; }
  protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    try {
      return new TypedValueImpl(new DatatypeConverterImpl().parseBase64Binary(pValue), byte[].class);
    } catch (NumberFormatException e) {
      throw new LocSAXException("Failed to convert string value to Base64Binary: " + pValue, getLocator());
    }
  }
View Full Code Here

    }
    values = (EnumValue[]) enums.toArray(new EnumValue[enums.size()]);
  }

  public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, Object pData) {
    return new TypedValueImpl(new Object[]{qName, ".fromString(", pValue, ")"}, qName);
  }
View Full Code Here

  }

  public TypedValue getCastFromString(SimpleTypeSG pController, String pValue) throws SAXException {
    for (int i = 0;  i < values.length;  i++) {
      if (values[i].getValue().equals(pValue)) {
        return new TypedValueImpl(values[i].getName(), qName);
      }
    }
    return super.getCastFromString(pController, pValue);
  }
View Full Code Here

    }
    return super.getCastFromString(pController, pValue);
  }

  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
    return new TypedValueImpl(new Object[]{pValue, ".toString()"}, String.class);
  }
View Full Code Here

      }
      value = new Object[]{converter, ".parse" + getDatatypeName() + "(", pValue, ")"};
    } else {
      value = new Object[]{pData, ".getDatatypeConverter().parse" + getDatatypeName() + "(", pValue, ")"};
    }
  return new TypedValueImpl(value, getDatatypeType());
  }
View Full Code Here

  public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod pMethod, Object pValue, DirectAccessible pData) {
    return getCastToString(pController, pValue, pData);
  }

  public TypedValue getCastToString(SimpleTypeSG pController, Object pValue, DirectAccessible pData) {
    return new TypedValueImpl(new Object[]{pData, ".getDatatypeConverter().print" + getDatatypeName() + "(", pValue, ")"},
                  String.class);
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.impl.TypedValueImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.