context.branch();
context.info("Processing " + method);
final Iterator containerTypes = method.getMetadataValues(SerializationConstants.CONTAINER_TYPE).iterator();
final Type list = this.getList();
final Type set = this.getSet();
final Type map = this.getMap();
context.branch();
context.debug("Parameters");
// first process parameters...
final Iterator parameters = method.getParameters().iterator();
while (parameters.hasNext()) {
final MethodParameter parameter = (MethodParameter) parameters.next();
final Type parameterType = parameter.getType();
context.debug(parameterType.getName());
// skip primitive types...
if (parameterType.isPrimitive()) {
continue;
}
writableTypes.add(parameterType);
context.debug(parameterType.getName());
if (parameterType.equals(list)) {
final Type listElementType = this.getTypeFromAnnotation(containerTypes, parameter);
writableTypes.add(listElementType);
context.debug(listElementType + " (List)");
continue;
}
if (parameterType.equals(set)) {
final Type setElementType = this.getTypeFromAnnotation(containerTypes, parameter);
writableTypes.add(setElementType);
context.debug(setElementType + " (Set)");
continue;
}
if (parameterType.equals(map)) {
final Type mapKeyType = this.getTypeFromAnnotation(containerTypes, parameter);
writableTypes.add(mapKeyType);
final Type mapValueType = this.getTypeFromAnnotation(containerTypes, parameter);
writableTypes.add(mapValueType);
context.debug(mapKeyType + " (Map Key)");
context.debug(mapValueType + " (Map Value)");
continue;
}
}
context.unbranch();
context.branch();
context.debug("Return type");
// process return type...
final Type returnType = method.getReturnType();
final Type voidd = this.getGeneratorContext().getVoid();
context.debug(returnType.getName());
// dont add if its primitive or void...
if (false == (returnType.equals(voidd) || returnType.isPrimitive())) {
readableTypes.add(returnType);
while (true) {
// skip primitive types...
if (returnType.isPrimitive()) {
break;
}
readableTypes.add(returnType);
context.debug(returnType.getName());
if (returnType.equals(list)) {
final Type listElementType = this.getTypeFromAnnotation(containerTypes, returnType);
readableTypes.add(listElementType);
context.debug(listElementType + " (List)");
break;
}
if (returnType.equals(set)) {
final Type setElementType = this.getTypeFromAnnotation(containerTypes, returnType);
readableTypes.add(setElementType);
context.debug(setElementType + " (Set)");
break;
}
if (returnType.equals(map)) {
final Type mapKeyType = this.getTypeFromAnnotation(containerTypes, returnType);
readableTypes.add(mapKeyType);
final Type mapValueType = this.getTypeFromAnnotation(containerTypes, returnType);
readableTypes.add(mapValueType);
context.debug(mapKeyType + " (Map Key)");
context.debug(mapValueType + " (Map Value)");
break;
}
}
}
context.unbranch();
context.branch();
context.debug("Thrown types");
// iterate over thrown types...
final Iterator thrownTypes = method.getThrownTypes().iterator();
while (thrownTypes.hasNext()) {
final Type type = (Type) thrownTypes.next();
context.debug(type.getName());
readableTypes.add(type);
}
context.unbranch();