Package org.apache.ws.jaxme.js

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


      JavaSource js = getSource(null);
      assertStringEquals(getResult(null), js.toString());
   }

   public void testDefaultProtection() {
      JavaSource js = getSource(JavaSource.DEFAULT_PROTECTION);
      assertStringEquals(getResult(JavaSource.DEFAULT_PROTECTION), js.toString());
   }
View Full Code Here


      JavaSource js = getSource(JavaSource.DEFAULT_PROTECTION);
      assertStringEquals(getResult(JavaSource.DEFAULT_PROTECTION), js.toString());
   }

   public void testPrivate() {
      JavaSource js = getSource(JavaSource.PRIVATE);
      assertStringEquals(getResult(JavaSource.PRIVATE), js.toString());
   }
View Full Code Here

      JavaSource js = getSource(JavaSource.PRIVATE);
      assertStringEquals(getResult(JavaSource.PRIVATE), js.toString());
   }

   public void testProtected() {
      JavaSource js = getSource(JavaSource.PROTECTED);
      assertStringEquals(getResult(JavaSource.PROTECTED), js.toString());
   }
View Full Code Here

      JavaSource js = getSource(JavaSource.PROTECTED);
      assertStringEquals(getResult(JavaSource.PROTECTED), js.toString());
   }

   public void testPublic() {
      JavaSource js = getSource(JavaSource.PUBLIC);
      assertStringEquals(getResult(JavaSource.PUBLIC), js.toString());
   }
View Full Code Here

      assertStringEquals(getResult(JavaSource.PUBLIC), js.toString());
   }

   public void testAbstract() {
     JavaSourceFactory factory = new JavaSourceFactory();
     JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"), JavaSource.PUBLIC);
     js.setAbstract(true);
     JavaMethod jm = js.newJavaMethod("test", JavaQNameImpl.VOID, JavaSource.PUBLIC);
     jm.setAbstract(true);
     assertStringEquals("public abstract void test();\n", jm.asString());
     assertStringEquals("package com.foo;\n" +
                  "\n" +
                  "public abstract class Bar {\n" +
                  "  public abstract void test();\n" +
                  "\n" +
                  "}\n", js.asString());
   }
View Full Code Here

                  "}\n", js.asString());
   }

   private JavaSource getPlaceHolderSource(boolean pAutoMode) {
     JavaSourceFactory factory = new JavaSourceFactory();
     JavaSource js = factory.newJavaSource(JavaQNameImpl.getInstance("com.foo", "Bar"), JavaSource.PUBLIC);
     JavaMethod main = js.newJavaMethod("main", JavaQNameImpl.VOID, JavaSource.PUBLIC);
     main.addParam(String[].class, "pArgs");
     main.setStatic(true);
     main.addThrows(Exception.class);
     main.addFor(int.class, " i = 1;  i < 10;  i++");
     main.newPlaceHolder("test", pAutoMode);
     main.addEndFor();
     js.setDynamicImports(true);
     return js;
   }
View Full Code Here

   public void testPlaceHolders() {
     boolean[] autoRemovable = new boolean[]{false, true};
     for (int i = 0;  i < autoRemovable.length;  i++) {
       boolean autoMode = autoRemovable[i];
       JavaSource js = getPlaceHolderSource(autoMode);
 
       if (autoMode) {
         assertStringEquals("package com.foo;\n" +
                      "\n" +
                      "public class Bar {\n" +
                      "  public static void main(java.lang.String[] pArgs) throws java.lang.Exception {\n" +
                      "    for (int i = 1;  i < 10;  i++) {\n" +
                      "    }\n" +
                      "  }\n" +
                      "\n" +
                      "}\n", js.asString());
       } else {
         boolean gotException = false;
         try {
           js.asString();
         } catch (IllegalStateException e) {
           gotException = true;
         }
         assertTrue(gotException);
       }

       js = getPlaceHolderSource(autoMode);
       JavaMethod main = js.getMethod("main", new JavaQName[]{JavaQNameImpl.getInstance(String[].class)});
       PlaceHolder test = main.getPlaceHolder("test");
       assertNotNull(test);
       test.remove();
       main.addLine("// I am here");

       String expect = "package com.foo;\n" +
                       "\n" +
                       "public class Bar {\n" +
                       "  public static void main(java.lang.String[] pArgs) throws java.lang.Exception {\n" +
                       "    for (int i = 1;  i < 10;  i++) {\n" +
                       "      // I am here\n" +
                       "    }\n" +
                       "  }\n" +
                       "\n" +
                       "}\n";
       String got = js.asString();
       assertStringEquals(expect, got);
     }
   }
View Full Code Here

    public Object newObjectSG(SGFactory pFactory, XSElement pElement) throws SAXException {
        ObjectSGChain chain = (ObjectSGChain) super.newObjectSG(pFactory, pElement);
        chain = new ObjectSGChainImpl(chain){
            public JavaSource getXMLImplementation(ObjectSG pController) throws SAXException {
                JavaSource result = super.getXMLImplementation(pController);
                JavaQName[] interfaces = result.getImplements();
                boolean done = false;
                result.clearImplements();
                for (int i = 0;  i < interfaces.length;  i++) {
                    JavaQName interfaceName = interfaces[i];
                    if (interfaceName.equals(JMELEMENT_TYPE||
                        interfaceName.equals(INO_OBJECT_TYPE)) {
                        if (!done) {
                            result.addImplements(INO_OBJECT_TYPE);
                            done = true;
                        }
                    } else {
                        result.addImplements(interfaceName);
                    }
                }
                if (!done) {
                    result.addImplements(INO_OBJECT_TYPE);
                }
                return result;
            }
        };
        return chain;
View Full Code Here

      return;
    }
    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
    if (customTableData != null) {
      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
      JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
      getPMClass(pController, js, customTableData);
    }
  }
View Full Code Here

          SchemaSG schemaSG = generator.generate(schemaFiles[i]);
          if (producesFilesSet != null) {
            JavaSourceFactory jsf = schemaSG.getJavaSourceFactory();
            File targetDirectory = getTarget();
            for (Iterator iter = jsf.getJavaSources();  iter.hasNext()) {
              JavaSource js = (JavaSource) iter.next();
              File f = jsf.getLocation(targetDirectory, js).getAbsoluteFile();
              producesFilesSet.remove(f);
            }
            for (Iterator iter = jsf.getTextFiles();  iter.hasNext()) {
              TextFile tf = (TextFile) iter.next();
View Full Code Here

TOP

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

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.