class TypeHelper {

    static String getTypeExpressionFor(ParsedType currentParsedType) {
        if(currentParsedType.parameters.isEmpty()) { // We're on a raw type
            return String.format("%s.class", currentParsedType.className);
        } else { // We're on a parameterized type
            return String.format("Types.newParameterizedType(%s.class, %s)",
                    currentParsedType.className,
                    FluentIterable.from(currentParsedType.parameters)
                        .transform(new Function<ParsedType, String>() {
                            @Override
                            public String apply(ParsedType param) {
                                return getTypeExpressionFor(param);
                            }
                        }).join(Joiner.on(", "))
                    );
        }
    }

}