Examples of JType


Examples of com.google.gwt.core.ext.typeinfo.JType

    private static XsrfRpcProxyCreator createMockedCreator() {
        JClassType classOrInterface = mock(JClassType.class, Mockito.RETURNS_DEEP_STUBS);
        when(classOrInterface.getName()).thenReturn("IExchangeRpc");
        when(classOrInterface.getPackage().getName()).thenReturn("com.cedarsolutions.santa.client.rpc");

        JType leafType = mock(JType.class);
        when(leafType.isPrimitive()).thenReturn(null);
        when(leafType.isClassOrInterface()).thenReturn(classOrInterface);

        JClassType type = mock(JClassType.class);
        when(type.getLeafType()).thenReturn(leafType);
        when(type.getQualifiedSourceName()).thenReturn("IExchangeRpc");
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JType

        return new XsrfRpcProxyCreator(type);
    }

    /** Create a mocked asynchronous method for testing. */
    private static JMethod createMockedAsyncMethod() {
        JType stringErasedType = mock(JType.class);
        when(stringErasedType.getQualifiedSourceName()).thenReturn("java.lang.String");

        JParameter name = mock(JParameter.class, Mockito.RETURNS_DEEP_STUBS);
        when(name.getType().getErasedType()).thenReturn(stringErasedType);
        when(name.getType().getErasedType().getQualifiedSourceName()).thenReturn("java.lang.String");
        when(name.getName()).thenReturn("name");

        JType callbackErasedType = mock(JType.class);
        when(callbackErasedType.getQualifiedSourceName()).thenReturn("com.google.gwt.user.client.rpc.AsyncCallback");

        JParameter callback = mock(JParameter.class, Mockito.RETURNS_DEEP_STUBS);
        when(callback.getType().getErasedType()).thenReturn(callbackErasedType);
        when(callback.getType().getErasedType().getQualifiedSourceName()).thenReturn("com.google.gwt.user.client.rpc.AsyncCallback");
        when(callback.getName()).thenReturn("callback");
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JType

     * called as expected from the token callback.
     * </p>
     */
    protected void generateClientRpcMethod(SourceWriter w, SerializableTypeOracle serializableTypeOracle,
                                           TypeOracle typeOracle, JMethod syncMethod, JMethod asyncMethod) {
        JType asyncReturnType = asyncMethod.getReturnType().getErasedType();
        String origSignature = "public " + asyncReturnType.getQualifiedSourceName() + " " + asyncMethod.getName();
        String newSignature = "public " + asyncReturnType.getQualifiedSourceName() + " _realRpcMethod_" + asyncMethod.getName();
        SourceWriter sourceWriter = new StringSourceWriter();
        super.generateProxyMethod(sourceWriter, serializableTypeOracle, typeOracle, syncMethod, asyncMethod);
        String method = sourceWriter.toString().replaceFirst(origSignature, newSignature);
        w.print(method);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JType

      return myDidChange || super.didChange();
    }

    @Override
    public void endVisit(JCastOperation x, Context ctx) {
      JType argType = x.getExpr().getType();
      if (!(x.getCastType() instanceof JReferenceType)
          || !(argType instanceof JReferenceType)) {
        return;
      }
View Full Code Here

Examples of com.sun.codemodel.JType

       
        JCodeModel model = generator.getCodeModel();
        JDefinedClass concat = model._getClass("org.codehaus.xfire.generator.messagepart.concatPortType");
        assertNotNull(concat);
       
        JType string = model._ref(String.class);
        JMethod method = concat.getMethod("concat", new JType[] { string, string });
       
        // if there were a way to look at the annotations we would do that here.
    }
View Full Code Here

Examples of com.sun.codemodel.JType

        }
        return true;
    }

    private JavaParameter getParameterFromProperty(Property property, JavaType.Style style, Part part) {
        JType t = property.type();
        String targetNamespace = ProcessorUtil.resolvePartNamespace(part);
        if (targetNamespace == null) {
            targetNamespace = property.elementName().getNamespaceURI();
        }
        JavaParameter parameter = new JavaParameter(property.name(), t.fullName(), targetNamespace);
        parameter.setStyle(style);
        parameter.setQName(property.elementName());
        if (style == JavaType.Style.OUT || style == JavaType.Style.INOUT) {
            parameter.setHolder(true);
            parameter.setHolderName(javax.xml.ws.Holder.class.getName());
            parameter.setHolderClass(t.boxify().fullName());
        }
        return parameter;
    }
View Full Code Here

Examples of com.sun.codemodel.JType

        }
        return parameter;
    }

    private JavaReturn getReturnFromProperty(Property property, Part part) {
        JType t = property.type();
        String targetNamespace = ProcessorUtil.resolvePartNamespace(part);
        if (targetNamespace == null) {
            targetNamespace = property.elementName().getNamespaceURI();
        }
        JavaReturn returnType = new JavaReturn(property.name(), t.fullName(), targetNamespace);
        returnType.setQName(property.elementName());
        returnType.setStyle(JavaType.Style.OUT);
        return returnType;
    }
View Full Code Here

Examples of com.sun.codemodel.JType

            if (mapping != null) {
                typeAnno = mapping.getType();
            }
        }
        if (typeAnno != null) {
            final JType type = typeAnno.getTypeClass();
            return new JAXBDefaultValueWriter(type);
        }
        return null;
    }
View Full Code Here

Examples of com.sun.codemodel.JType

                    writer.write("();");
                    fillInFields(writer, indent, path, varName, jdc);
                }
            } else {
                boolean found = false;
                JType tp2 = tp.erasure();
                try {
                    Field f = tp2.getClass().getDeclaredField("_class");
                    ReflectionUtil.setAccessible(f);
                    Class<?> cls = (Class<?>)f.get(tp2);
                    if (List.class.isAssignableFrom(cls)) {
                        found = true;
View Full Code Here

Examples of com.sun.codemodel.JType

                //no default values for abstract classes
                typeAnno = null;
            }
        }
        if (typeAnno != null) {
            final JType type = typeAnno.getTypeClass();
            return new JAXBDefaultValueWriter(type);
        }
        return null;
    }
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.