Package com.sun.codemodel

Examples of com.sun.codemodel.JDefinedClass


        generator.setOverwrite(true);
       
        generator.generate();
       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("org.codehaus.xfire.generator.wsrp.WSRPServiceClient");
        assertNotNull(echo);
    }
View Full Code Here


        generator.setProfile(JAXWSProfile.class.getName());
       
        generator.generate();
       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("services.global.GlobalWeatherService");
        assertNotNull(echo);
    }
View Full Code Here

        generator.setProfile(JAXWSProfile.class.getName());
       
        generator.generate();
       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("services.headerout.EchoPortType");
        assertNotNull(echo);
    }
View Full Code Here

        generator.setProfile(JAXWSProfile.class.getName());
       
        generator.generate();
       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass echo = model._getClass("services.echo.EchoPortType");
        assertNotNull(echo);
    }
View Full Code Here

            || "generated".equals(name)) {
            return false;
        }
        Iterator<JDefinedClass> i = jpackage.classes();
        while (i.hasNext()) {
            JDefinedClass current = i.next();
            if ("ObjectFactory".equals(current.name())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

                writer.write(" {};");
            } else if (DEFAULT_TYPE_MAP.contains(tp.fullName())) {
                writeDefaultType(writer, tp, path);
                writer.write(";");
            } else if (tp instanceof JDefinedClass) {
                JDefinedClass jdc = (JDefinedClass)tp;
                if (jdc.getClassType() == ClassType.ENUM) {
                    //no way to get the field list as it's private with
                    //no accessors :-(
                    try {
                        Field f = jdc.getClass().getDeclaredField("enumConstantsByName");
                        ReflectionUtil.setAccessible(f);
                        Map<?, ?> map = (Map<?, ?>)f.get(jdc);
                        Set<String> values = CastUtils.cast(map.keySet());
                        String first = defaultValues.chooseEnumValue(path, values);
                        writer.write(tp.fullName());
                        writer.write(".");
                        writer.write(first);
                        writer.write(";");
                    } catch (Exception e) {
                        IOException ex = new IOException(e.getMessage());
                        ex.initCause(e);
                        throw ex;
                    }
                } else if (jdc.isAbstract()) {
                    writer.write("null;");
                } else {
                    writer.write("new ");
                    writer.write(tp.fullName());
                    writer.write("();");
View Full Code Here

            if (mapping != null) {
                typeAnno = mapping.getType();
            }
        }
        if (typeAnno != null && typeAnno.getTypeClass() instanceof JDefinedClass) {
            JDefinedClass dc = (JDefinedClass)typeAnno.getTypeClass();
            if (dc.isAbstract()) {
                //no default values for abstract classes
                typeAnno = null;
            }
        }
        if (typeAnno != null) {
View Full Code Here

                writer.write(" {};");
            } else if (DEFAULT_TYPE_MAP.contains(tp.fullName())) {
                writeDefaultType(writer, tp, path);
                writer.write(";");
            } else if (tp instanceof JDefinedClass) {
                JDefinedClass jdc = (JDefinedClass)tp;
                if (jdc.getClassType() == ClassType.ENUM) {
                    //no way to get the field list as it's private with
                    //no accessors :-(
                    try {
                        Field f = jdc.getClass().getDeclaredField("enumConstantsByName");
                        f.setAccessible(true);
                        Map map = (Map)f.get(jdc);
                        Set<String> values = CastUtils.cast(map.keySet());
                        String first = defaultValues.chooseEnumValue(path, values);
                        writer.write(tp.fullName());
View Full Code Here

        this(routerClass, generator, JMod.PUBLIC | JMod.STATIC);
    }

    public JDefinedClass build(List<RouteClass> routeClassList) {
        for (RouteClass routeClass : routeClassList) {
            JDefinedClass definedClass = generator.generate(routeClass);
            if (definedClass == null) continue;

            addRouterMethod(routerClass, definedClass);
        }
View Full Code Here

        this.visitor = visitor;
    }

    @Override
    protected void run(Set<ClassOutline> classes) {
        final JDefinedClass _interface = outline.getClassFactory().createInterface(jpackage, "Visitable", null);
    setOutput( _interface );
    final JMethod _method = getOutput().method(JMod.PUBLIC, void.class, "accept");
    final JTypeVar returnType = _method.generify("R");
    final JTypeVar exceptionType = _method.generify("E", Throwable.class);
    _method.type(returnType);
View Full Code Here

TOP

Related Classes of com.sun.codemodel.JDefinedClass

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.