List of usage examples for com.google.gwt.core.ext.typeinfo JPrimitiveType getUninitializedFieldExpression
public String getUninitializedFieldExpression()
From source file:com.github.nmorel.gwtjackson.rebind.CreatorUtils.java
License:Apache License
/** * Returns the default value of the given type. * <ul>/*from w ww . j ava 2s. com*/ * <li>{@link Object} : null</li> * <li>char : '\u0000'</li> * <li>boolean : false</li> * <li>other primitive : 0</li> * </ul> * * @param type type to find the default value * * @return the default value of the type. */ public static String getDefaultValueForType(JType type) { JPrimitiveType primitiveType = type.isPrimitive(); if (null != primitiveType) { return primitiveType.getUninitializedFieldExpression(); } return "null"; }
From source file:com.gwtplatform.dispatch.rest.delegates.rebind.DelegateMethodGenerator.java
License:Apache License
private String resolveReturnValue() { String returnValue = null;/* ww w .ja va 2 s . co m*/ JType returnType = getMethod().getReturnType(); JPrimitiveType primitiveType = returnType.isPrimitive(); if (primitiveType != null) { if (primitiveType != JPrimitiveType.VOID) { returnValue = primitiveType.getUninitializedFieldExpression(); } } else { returnValue = "null"; } return returnValue; }