Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.DirectAccessible


        } else {
          pParticle.getPropertySG().addValue(pJm, pElement, v, type);
        }
      } else {
        PropertySG pSG;
        DirectAccessible element;
        if (isMixed) {
          LocalJavaField f = pJm.newJavaField(GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLInterfaceName()));
          f.addLine("new ", GroupUtil.getContentClass(group, pParticle, ctSG.getClassContext().getXMLImplementationName()), "()");
          PropertySGChain chain = ((PropertySGImpl) pParticle.getPropertySG()).getHeadOfChain();
          PropertySGChain head = new PropertySGChainImpl(chain){
View Full Code Here


  }
 
  public void forAllValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
    LocalJavaField list = pMethod.newJavaField(List.class);
    list.addLine(pController.getValue(pElement));
    DirectAccessible i = pMethod.addForList(list);
    TypeSG typeSG = objectSG.getTypeSG();
    Object v;
    boolean isCasting = !OBJECT_TYPE.equals(typeSG.getRuntimeType());
    if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
      isCasting = ((SGlet.TypedSGlet) pSGlet).isCasting();
View Full Code Here

  }
 
  public void forAllNonNullValues(PropertySG pController, JavaMethod pMethod, DirectAccessible pElement, SGlet pSGlet) throws SAXException {
    LocalJavaField list = pMethod.newJavaField(List.class);
    list.addLine(pController.getValue(pElement));
    DirectAccessible i = pMethod.addForList(list);
    TypeSG typeSG = objectSG.getTypeSG();
    boolean isCasting = !OBJECT_TYPE.equals(typeSG.getRuntimeType());
    JavaQName qName = typeSG.getRuntimeType();
    if (isCasting  &&  pSGlet instanceof SGlet.TypedSGlet) {
      SGlet.TypedSGlet typedSGlet = (SGlet.TypedSGlet) pSGlet;
View Full Code Here

    instances.addLine(new Object[]{"new ", qNameArray, "{", instanceParams, "}"});
    instances.setStatic(true);
    instances.setFinal(true);

    JavaConstructor con = js.newJavaConstructor(JavaSource.PRIVATE);
    DirectAccessible pName = con.addParam(String.class, "pName");
    DirectAccessible pValue = con.addParam(super.getRuntimeType(pController), "pValue");
    DirectAccessible pLexicalValue = con.addParam(String.class, "pLexicalValue");
    con.addLine(name, " = ", pName, ";");
    con.addLine(value, " = ", pValue, ";");
    con.addLine(lexicalValue, " = ", pLexicalValue, ";");

    JavaMethod toStringMethod = js.newJavaMethod("toString", String.class, JavaSource.PUBLIC);
    toStringMethod.addLine("return ", lexicalValue, ";");

    JavaMethod getValueMethod = js.newJavaMethod("getValue", valueType, JavaSource.PUBLIC);
    getValueMethod.addLine("return ", value, ";");

    JavaMethod getNameMethod = js.newJavaMethod("getName", String.class, JavaSource.PUBLIC);
    getNameMethod.addLine("return ", name, ";");

    JavaMethod getInstancesMethod = js.newJavaMethod("getInstances", qNameArray, JavaSource.PUBLIC);
    getInstancesMethod.setStatic(true);
    getInstancesMethod.addLine("return ", instances, ";");

    JavaMethod fromValueMethod = js.newJavaMethod("fromValue", qName, JavaSource.PUBLIC);
    pValue = fromValueMethod.addParam(valueType, "pValue");
    fromValueMethod.setStatic(true);
    DirectAccessible i = fromValueMethod.addForArray(instances);
    fromValueMethod.addIf(pController.getEqualsCheck(fromValueMethod, new Object[]{instances, "[", i, "].value"}, pValue));
    fromValueMethod.addLine("return ", instances, "[", i, "];");
    fromValueMethod.addEndIf();
    fromValueMethod.addEndFor();
    fromValueMethod.addThrowNew(IllegalArgumentException.class, JavaSource.getQuoted("Invalid value: "),
View Full Code Here

        }
      }
    }

    JavaMethod jm = js.newJavaMethod("getPreferredPrefix", String.class, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    if (!uris.isEmpty()) {
      jm.addIf(pURI, " == null");
      jm.addLine(pURI, " = \"\";");
      jm.addEndIf();
      boolean first = true;
View Full Code Here

    return jm;
  }

  private JavaMethod newGetAttributesMethod(ComplexTypeSG pType) throws SAXException {
    JavaMethod jm = js.newJavaMethod("getAttributes", AttributesImpl.class, JavaSource.PUBLIC);
    final DirectAccessible pController = jm.addParam(JMSAXDriverController.class, "pController");
    DirectAccessible pObject = jm.addParam(Object.class, "pObject");
    jm.addThrows(SAXException.class);
    final LocalJavaField result = jm.newJavaField(AttributesImpl.class);
    result.addLine("new ", AttributesImpl.class, "()");
    AttributeSG[] myAttributes = pType.getAttributes();
    if (myAttributes.length > 0) {
      JavaQName elementInterface = pType.getClassContext().getXMLInterfaceName();
      LocalJavaField element = jm.newJavaField(elementInterface);
      element.addLine("(", elementInterface, ") ", pObject);
     
      for (int i = 0;  i < myAttributes.length;  i++) {
        final AttributeSG attribute = myAttributes[i];
        if (attribute.isWildcard()) {
            LocalJavaField anyAttributes = jm.newJavaField(WildcardAttribute[].class);
            anyAttributes.addLine(element, ".", attribute.getPropertySG().getXMLGetMethodName() + "Array", "()");
            DirectAccessible index = jm.addForArray(anyAttributes);
            LocalJavaField wildcardAttribute = jm.newJavaField(WildcardAttribute.class);
            wildcardAttribute.addLine(anyAttributes, "[", index, "]");
          LocalJavaField qName = jm.newJavaField(QName.class);
          qName.addLine(wildcardAttribute, ".getName()");
          LocalJavaField uri = jm.newJavaField(String.class);
View Full Code Here

    private TypedValue getParseCall(SimpleTypeSG pController, JavaMethod pMethod,
                                Object pValue, Object pData)
            throws SAXParseException {
        JavaQName type = getType(pController);
        DirectAccessible value = getValue(pMethod, pValue, JavaQNameImpl.getInstance(String.class));

        String parseMethod = javaType.getParseMethod().trim();
        List list = new ArrayList();
        if (parseMethod.startsWith("new")
            &&  parseMethod.length() > 3
View Full Code Here

    private TypedValue getPrintCall(SimpleTypeSG pController, JavaMethod pMethod,
                                Object pValue, Object pData) {
      JavaQName type = getType(pController);
        LocalJavaField f = pMethod.newJavaField(String.class);
        DirectAccessible value = getValue(pMethod, pValue, type);
        List list = new ArrayList();
        addCall(pController, list, javaType.getPrintMethod(), type);
        addValues(list, value, pData);
        pMethod.addTry();
        pMethod.addLine(f, " = ", list, ";");
        DirectAccessible e = pMethod.addCatch(Exception.class);
        pMethod.addLine(pData, ".printConversionEvent(pObject, ",
                        JavaSource.getQuoted("Failed to convert value "),
                        " + ", value, " + ", JavaSource.getQuoted(": "),
                        " + ", e, ".getClass().getName(), ", e, ");");
        pMethod.addLine(f, " = null;");
View Full Code Here

    castedElement.addLine("(", elementInterface, ") ", element);
    isMixed = pType.getComplexContentSG().isMixed();
    if (isMixed) {
      LocalJavaField list = jm.newJavaField(List.class);
      list.addLine(castedElement, ".getContent()");
      DirectAccessible i = jm.addForList(list);
      object = jm.newJavaField(Object.class);
      object.addLine(list, ".get(", i, ")");
      mixedTypesMap = new HashSet();
      jm.addIf(object, " instanceof ", String.class);
      LocalJavaField s = jm.newJavaField(String.class);
View Full Code Here

    if (myAttributes.length == 0) {
      return null;
    }
   
    JavaMethod jm = getJavaSource().newJavaMethod("addAttribute", JavaQNameImpl.VOID, JavaSource.PUBLIC);
    DirectAccessible pURI = jm.addParam(String.class, "pURI");
    DirectAccessible pLocalName = jm.addParam(String.class, "pLocalName");
    DirectAccessible pValue = jm.addParam(String.class, "pValue");
    jm.addThrows(SAXException.class);
    jm.addIf(pURI, " == null");
    jm.addLine(pURI, " = \"\";");
    jm.addEndIf();
   
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.DirectAccessible

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.