AutoBeanMethod.Builder builder = new AutoBeanMethod.Builder(); builder.setMethod(method); for (JClassType noWrap : noWrapTypes) { if (noWrap.isAssignableFrom(classReturn)) { builder.setNoWrap(true); break; builder.setAction(action); if (JBeanMethod.CALL.equals(action)) { JMethod staticImpl = findStaticImpl(beanType, method); builder.setStaticImp(staticImpl); AutoBeanMethod toAdd = builder.build();
public void setMethod(JMethod method) { toReturn.method = method; TypeOracle oracle = method.getEnclosingType().getOracle(); JType returnType = method.getReturnType(); toReturn.isValueType = ModelUtils.isValueType(oracle, returnType); if (!toReturn.isValueType) { // See if it's a collection or a map JClassType returnClass = returnType.isClassOrInterface(); JClassType collectionInterface = oracle.findType(Collection.class.getCanonicalName()); JClassType mapInterface = oracle.findType(Map.class.getCanonicalName()); if (collectionInterface.isAssignableFrom(returnClass)) { JClassType[] parameterizations = ModelUtils.findParameterizationOf( collectionInterface, returnClass); toReturn.elementType = parameterizations[0]; maybeProcessEnumType(toReturn.elementType); } else if (mapInterface.isAssignableFrom(returnClass)) { JClassType[] parameterizations = ModelUtils.findParameterizationOf( mapInterface, returnClass); toReturn.keyType = parameterizations[0]; toReturn.valueType = parameterizations[1]; maybeProcessEnumType(toReturn.keyType); maybeProcessEnumType(toReturn.valueType); } } else { maybeProcessEnumType(returnType); } }
AutoBeanMethod.Builder builder = new AutoBeanMethod.Builder(); builder.setMethod(method); for (JClassType noWrap : noWrapTypes) { if (noWrap.isAssignableFrom(classReturn)) { builder.setNoWrap(true); break; builder.setAction(action); if (JBeanMethod.CALL.equals(action)) { JMethod staticImpl = findStaticImpl(beanType, method); builder.setStaticImp(staticImpl); AutoBeanMethod toAdd = builder.build();
public void setMethod(JMethod method) { toReturn.method = method; TypeOracle oracle = method.getEnclosingType().getOracle(); JType returnType = method.getReturnType(); toReturn.isValueType = ModelUtils.isValueType(oracle, returnType); if (!toReturn.isValueType) { // See if it's a collection or a map JClassType returnClass = returnType.isClassOrInterface(); JClassType collectionInterface = oracle.findType(Collection.class.getCanonicalName()); JClassType mapInterface = oracle.findType(Map.class.getCanonicalName()); if (collectionInterface.isAssignableFrom(returnClass)) { JClassType[] parameterizations = ModelUtils.findParameterizationOf( collectionInterface, returnClass); toReturn.elementType = parameterizations[0]; maybeProcessEnumType(toReturn.elementType); } else if (mapInterface.isAssignableFrom(returnClass)) { JClassType[] parameterizations = ModelUtils.findParameterizationOf( mapInterface, returnClass); toReturn.keyType = parameterizations[0]; toReturn.valueType = parameterizations[1]; maybeProcessEnumType(toReturn.keyType); maybeProcessEnumType(toReturn.valueType); } } else { maybeProcessEnumType(returnType); } }
/** * Call {@link #processEnumType(JEnumType)} if {@code type} is a * {@link JEnumType}. */ private void maybeProcessEnumType(JType type) { assert type != null : "type == null"; JEnumType enumType = type.isEnum(); if (enumType != null) { processEnumType(enumType); } }
/** * Call {@link #processEnumType(JEnumType)} if {@code type} is a * {@link JEnumType}. */ private void maybeProcessEnumType(JType type) { assert type != null : "type == null"; JEnumType enumType = type.isEnum(); if (enumType != null) { processEnumType(enumType); } }