Package com.google.gwt.core.ext.typeinfo

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


                .findInheritedMethod(type, "getState");
        bundle.setNeedsReturnType(type, getState);

        bundle.setNeedsSerialize(getState.getReturnType());

        JType stateType = getState.getReturnType();
        bundle.setNeedsGwtConstructor(stateType.isClass());
    }
View Full Code Here


    }

    @Override
    protected void printDeserializerBody(TreeLogger logger, SourceWriter w,
            String type, String jsonValue, String connection) {
        JType leafType = arrayType.getLeafType();
        int rank = arrayType.getRank();

        w.println(JSONArray.class.getName() + " jsonArray = " + jsonValue
                + ".isArray();");

        // Type value = new Type[jsonArray.size()][][];
        w.print(arrayType.getQualifiedSourceName() + " value = new "
                + leafType.getQualifiedSourceName() + "[jsonArray.size()]");
        for (int i = 1; i < rank; i++) {
            w.print("[]");
        }
        w.println(";");

        w.println("for(int i = 0 ; i < value.length; i++) {");
        w.indent();

        JType componentType = arrayType.getComponentType();

        w.print("value[i] = ("
                + ConnectorBundleLoaderFactory.getBoxedTypeName(componentType)
                + ") " + JsonDecoder.class.getName() + ".decodeValue(");
        ConnectorBundleLoaderFactory.writeTypeCreator(w, componentType);
View Full Code Here

    }

    @Override
    protected void printSerializerBody(TreeLogger logger, SourceWriter w,
            String value, String applicationConnection) {
        JType componentType = arrayType.getComponentType();

        w.println(JSONArray.class.getName() + " values = new "
                + JSONArray.class.getName() + "();");
        // JPrimitiveType primitive = componentType.isPrimitive();
        w.println("for (int i = 0; i < " + value + ".length; i++) {");
View Full Code Here

            JMethod deserializeMethod = serializer.findMethod(
                    deserializeMethodName, deserializeParamTypes);
            if (deserializeMethod == null) {
                continue;
            }
            JType returnType = deserializeMethod.getReturnType();

            serializers.put(returnType, serializer);
        }
        return serializers;
    }
View Full Code Here

    private void purgeSerializeSupportQueue(TreeLogger logger)
            throws UnableToCompleteException {
        while (!needsSerializeSupport.isEmpty()) {
            Iterator<JType> iterator = needsSerializeSupport.iterator();
            JType type = iterator.next();
            iterator.remove();

            if (hasSerializeSupport(type)) {
                continue;
            }
View Full Code Here

            setNeedsGwtConstructor(typeAsClass);

            for (Property property : getProperties(typeAsClass)) {
                setNeedsProperty(property);

                JType propertyType = property.getPropertyType();
                setNeedsSerialize(propertyType);
            }
        }
    }
View Full Code Here

    public JType getPropertyType() {
        return propertyType;
    }

    public String getUnboxedPropertyTypeName() {
        JType propertyType = getPropertyType();
        JPrimitiveType primitive = propertyType.isPrimitive();
        if (primitive != null) {
            return primitive.getQualifiedBoxedSourceName();
        } else {
            return propertyType.getQualifiedSourceName();
        }
    }
View Full Code Here

    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

        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

     * 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

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JType

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.