Package com.sun.codemodel

Examples of com.sun.codemodel.JDefinedClass.method()


            JType returnType = getReturnType(context, schema, op);
           
            String name = javify(op.getName());
            name = name.substring(0, 1).toLowerCase() + name.substring(1);
           
            JMethod method = jc.method(JMod.PUBLIC, returnType, name);
           
            String opDocumentation = op.getDocumenation();
            if( opDocumentation != null ){
                method.javadoc().add(opDocumentation);
            }
View Full Code Here


 
        /**
         * getEndpoint(Endpoint)
         */
        JClass objectType = model.ref(Object.class);
        getEndpoint = servCls.method(JMod.PUBLIC, objectType, "getEndpoint");
        JVar epVar = getEndpoint.param(Endpoint.class, "endpoint");
       
        JBlock geBody = getEndpoint.body();
        JTryBlock tryBlock = geBody._try();
       
View Full Code Here

       

        /**
         * T getEndpoint(QName)
         */
        JMethod getEndpointByName = servCls.method(JMod.PUBLIC, objectType, "getEndpoint");
        JVar epname = getEndpointByName.param(QName.class, "name");
       
        geBody = getEndpointByName.body();
       
        // Endpoint endpoint = (Endpoint) service.getEndpoint(name);
View Full Code Here

       
        /**
         * Collection getEndpoints()
         */
        JType collectionType = model.ref(Collection.class);
        JMethod getEndpoints = servCls.method(JMod.PUBLIC, collectionType, "getEndpoints");
        geBody = getEndpoints.body();
       
        geBody._return(endpointsVar.invoke("values"));
       
        // Create a Service for each Binding
View Full Code Here

        JType hashMapType = model._ref(HashMap.class);
        JType mapType = model._ref(Map.class);
        JVar portsVar = servCls.field(JMod.PRIVATE + JMod.STATIC,
                                      mapType, "ports", JExpr._new(hashMapType));

        JMethod method = servCls.method(JMod.PUBLIC + JMod.STATIC, mapType, "getPortClassMap");
        method.body()._return(JExpr.ref("ports"));
       
        for (Service service : services)
        {
            JClass serviceIntf = (JClass) service.getProperty(ServiceInterfaceGenerator.SERVICE_INTERFACE);
View Full Code Here

                JInvocation bindingQN = JExpr._new(qnameType);
                bindingQN.arg(endpoint.getBinding().getName().getNamespaceURI());
                bindingQN.arg(endpoint.getBinding().getName().getLocalPart());

                // Add a getFooEndpointMethod
                JMethod getFooEndpoint = servCls.method(JMod.PUBLIC, serviceIntf, javify("get" + endpoint.getName().getLocalPart()));
                JBlock geBody = getFooEndpoint.body();
   
                geBody._return(JExpr.cast(serviceIntf, JExpr.direct("this").invoke("getPort").arg(newQN).arg(intfClass)));
               
                JAnnotationUse weAnn = getFooEndpoint.annotate(WebEndpoint.class);
View Full Code Here

        // Modify interface as well:
        if (implementationInterface != null) {
          writeSummary("\tCorrecting interface " + implementationInterface.fullName());

          implementationInterface.method(JMod.PUBLIC, collectionInterfaceClass, "get" + propertyName);
          setterMethod = implementationInterface.method(JMod.PUBLIC, codeModel.VOID, "set" + propertyName);
          setterMethod.param(collectionInterfaceClass, fieldName);
        }

        modificationCount += createScopedFactoryMethods(codeModel, candidate.getValueObjectFactoryClass(),
View Full Code Here

        // Modify interface as well:
        if (implementationInterface != null) {
          writeSummary("\tCorrecting interface " + implementationInterface.fullName());

          implementationInterface.method(JMod.PUBLIC, collectionInterfaceClass, "get" + propertyName);
          setterMethod = implementationInterface.method(JMod.PUBLIC, codeModel.VOID, "set" + propertyName);
          setterMethod.param(collectionInterfaceClass, fieldName);
        }

        modificationCount += createScopedFactoryMethods(codeModel, candidate.getValueObjectFactoryClass(),
                    candidate.getScopedElementInfos().values(), targetClass);
View Full Code Here

     * {@link JAXBContext} object can be used.
     */
    private void generateClassList() {
        try {
            JDefinedClass jc = codeModel.rootPackage()._class("JAXBDebug");
            JMethod m = jc.method(JMod.PUBLIC|JMod.STATIC,JAXBContext.class,"createContext");
            JVar $classLoader = m.param(ClassLoader.class,"classLoader");
            m._throws(JAXBException.class);
            JInvocation inv = codeModel.ref(JAXBContext.class).staticInvoke("newInstance");
            m.body()._return(inv);

View Full Code Here

            // final <valueType> value;
            JFieldVar $value = type.field( JMod.PRIVATE|JMod.FINAL, baseExposedType, "value" );

            // [RESULT]
            // public <valuetype> value() { return value; }
            type.method(JMod.PUBLIC, baseExposedType, "value" ).body()._return($value);

            // [RESULT]
            // <constructor>(<valueType> v) {
            //     this.value=v;
            // }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.