static public TypeDeclarationBuilder typeDeclaration(String name) { return new TypeDeclarationBuilder(name); }
private TypeDeclarationBuilder handleEnum(final RamlType quickType, final RamlAdjuster adjuster) { Class<? extends Enum> c = (Class<? extends Enum>) quickType.type(); TypeBuilder typeBuilder = TypeBuilder.type().enumValues( FluentIterable.of(c.getEnumConstants()).transform(new Function<Enum, String>() { @Nullable @Override public String apply(@Nullable Enum o) { return adjuster.adjustEnumValue(quickType.type(), o.name()); } }).toArray(String.class) ); adjuster.adjustType(quickType.type(), quickType.getRamlSyntax().id(), typeBuilder); return TypeDeclarationBuilder.typeDeclaration(quickType.getRamlSyntax().id()).ofType(typeBuilder); }
@Override public Result classToRaml(Class<?> clazz) { RamlType type = RamlTypeFactory.forType(clazz, classParserFactory.createParser(clazz), adjusterFactory); if ( type.isScalar()) { return new Result(null, Collections.<String, TypeDeclarationBuilder>emptyMap()); } Map<String, TypeDeclarationBuilder> dependentTypes = new HashMap<>(); TypeDeclarationBuilder builder = handleSingleType(clazz, dependentTypes); dependentTypes.remove(builder.id()); return new Result(builder, dependentTypes); }
if ( quickType.isScalar()) { return TypeDeclarationBuilder.typeDeclaration(quickType.getRamlSyntax().id()).ofType(quickType.getRamlSyntax()); TypeDeclarationBuilder typeDeclaration = TypeDeclarationBuilder.typeDeclaration(simpleName).ofType(builder); if ( !ScalarType.isRamalScalarType(simpleName)) { builtTypes.put(simpleName, typeDeclaration);