String defaultValue = null; if (param.getType().isPrimitive() != null) { defaultValue = param.getType().isPrimitive().getUninitializedFieldExpression();
JPrimitiveType returnType = userMethod.getReturnType().isPrimitive(); if (returnType == null) { logger.log(TreeLogger.ERROR, name + ": Return type must be primitive type " +
private void maybeStartUnboxing(final StringBuilder b, final JType returnType) { if (JPrimitiveType.LONG == returnType.isPrimitive()) { b.append("@" + GWT_REFLECT + "::unboxLong(Ljava/lang/Number;)("); } }
private void maybeStartUnboxing(StringBuilder b, JType returnType) { if (JPrimitiveType.LONG == returnType.isPrimitive()) { b.append("@"+GWT_REFLECT+"::unboxLong(Ljava/lang/Number;)("); } } protected JMethodCall checkConstPool(UnifyAstView ast, JMethodCall callSite, JExpression classRef,
JPrimitiveType returnType = toImplement.getReturnType().isPrimitive(); if (returnType == null) { logger.log(TreeLogger.ERROR, toImplement.getName()
private RequestCallbackAdapter.ResponseReader getResponseReaderFor(JType returnType) { if (returnType.isPrimitive() != null) { return JPRIMITIVETYPE_TO_RESPONSEREADER.get(returnType.isPrimitive()); } if (returnType.getQualifiedSourceName().equals(String.class.getCanonicalName())) { return RequestCallbackAdapter.ResponseReader.STRING; } return RequestCallbackAdapter.ResponseReader.OBJECT; } }
private ResponseReader getResponseReaderFor(JType returnType) { if (returnType.isPrimitive() != null) { return JPRIMITIVETYPE_TO_RESPONSEREADER.get(returnType.isPrimitive()); } if (returnType.getQualifiedSourceName().equals(String.class.getCanonicalName())) { return ResponseReader.STRING; } return ResponseReader.OBJECT; }
protected String castFromString(JType type, String value) { if (type.isPrimitive() != null) { JPrimitiveType primitiveType = type.isPrimitive(); return "(" + primitiveType.getQualifiedBoxedSourceName() + ")" + value; } return "(" + type.getQualifiedSourceName() + ")" + value; } }
JPrimitiveType expectedIsPrimitive = expectedReturnType.isPrimitive(); JClassType expectedIsClassType = expectedReturnType.isClassOrInterface(); boolean error = false;
/** * Determines whether a particular type needs to be cast to become its final * type. Primitives and Strings do not, as they are read directly as the * correct type. All other Objects need a cast, except for Object itself. * * @param type the type in question * @return <code>true</code> if the results of a read method must be cast, * otherwise <code>false</code>. */ static boolean typeNeedsCast(JType type) { return type.isPrimitive() == null && !type.getQualifiedSourceName().equals("java.lang.String") && !type.getQualifiedSourceName().equals("java.lang.Object"); }
private boolean typesMatch(JClassType a, JType b) { if (b.isPrimitive() != null) { return a.getQualifiedSourceName().equals(b.isPrimitive().getQualifiedBoxedSourceName()); } else { assert b.isClassOrInterface() != null; return b.isClassOrInterface().isAssignableTo(a); } }
private boolean isNonPrimitive(final JMethod method, final UnifyAstView ast) { final JType returnType = method.getReturnType(); return returnType.isPrimitive() == null && !PRIMITIVES.contains(returnType.getQualifiedSourceName()); }
private String getQualifiedSourceNonPrimitiveType(JType elementType) { JPrimitiveType primitive = elementType.isPrimitive(); return primitive == null ? elementType.getQualifiedSourceName() : primitive.getQualifiedBoxedSourceName(); }
private String getQualifiedSourceNonPrimitiveType(JType elementType) { JPrimitiveType primitive = elementType.isPrimitive(); return primitive == null ? elementType.getQualifiedSourceName() : primitive.getQualifiedBoxedSourceName(); }
private String getMethodCallback(JMethod method) { if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); return "org.fusesource.restygwt.client.MethodCallback<" + primitiveType.getQualifiedBoxedSourceName() + "> callback"; } String returnType = method.getReturnType().getParameterizedQualifiedSourceName(); if (isOverlayMethod(method)) { return "org.fusesource.restygwt.client.OverlayCallback<" + returnType + "> callback"; } return "org.fusesource.restygwt.client.MethodCallback<" + returnType + "> callback"; }
private void generateReturnNull(JMethod method) { if (isVoidMethod(method)) { // check void first since JPrimitiveType will consider void to be a primitive return; } else if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); p("return " + primitiveType.getUninitializedFieldExpression() + ";"); } else { p("return null;"); } }
private void generateReturnNull(JMethod method) { if (isVoidMethod(method)) { // check void first since JPrimitiveType will consider void to be a primitive return; } else if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); p("return " + primitiveType.getUninitializedFieldExpression() + ";"); } else { p("return null;"); } }
private String resolveReturnValue() { String returnValue = null; JType returnType = getMethod().getReturnType(); JPrimitiveType primitiveType = returnType.isPrimitive(); if (primitiveType != null) { if (primitiveType != JPrimitiveType.VOID) { returnValue = primitiveType.getUninitializedFieldExpression(); } } else { returnValue = "null"; } return returnValue; }
private String getMethodCallback(JMethod method) { if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); return "org.fusesource.restygwt.client.MethodCallback<" + primitiveType.getQualifiedBoxedSourceName() + "> callback"; } String returnType = method.getReturnType().getParameterizedQualifiedSourceName(); if (isOverlayMethod(method)) { return "org.fusesource.restygwt.client.OverlayCallback<" + returnType + "> callback"; } return "org.fusesource.restygwt.client.MethodCallback<" + returnType + "> callback"; }
private boolean isNumber(JType type) { JClassType numberType = typeOracle.findType(Number.class.getCanonicalName()); JClassType asClass = type.isClass(); if (asClass != null) { return numberType.isAssignableFrom(asClass); } JPrimitiveType asPrimitive = type.isPrimitive(); if (asPrimitive != null) { JClassType autoboxed = typeOracle.findType(asPrimitive.getQualifiedBoxedSourceName()); return numberType.isAssignableFrom(autoboxed); } return false; }