public static RamlDocumentBuilder document() { return new RamlDocumentBuilder(); }
RamlDocumentBuilder documentBuilder = RamlDocumentBuilder.document(); try { documentBuilder .title(modelApi.getTitle()) .baseUri(modelApi.getBaseUri()) .mediaType(modelApi.getDefaultMediaType().toStringRepresentation()) .version(modelApi.getVersion()); Api api = documentBuilder.buildModel(); final GrammarPhase grammarPhase = new GrammarPhase(RamlHeader.getFragmentRule(new RamlHeader(RAML_10, Default).getFragment()));
private void resources(RamlDocumentBuilder builder, RamlApi modelApi) throws IOException { for (RamlResource ramlResource : modelApi.getResources()) { ResourceBuilder resourceBuilder = handleResource(ramlResource); builder.with(resourceBuilder); } }
public Api buildModel() { NodeModelFactory fac = binding.bindingOf(Api.class); Node node = buildNode(); NodeModel model = fac.create(node); //return ModelProxyBuilder.createModel(Api.class, model, binding); return Util.buildModel(binding, node, Api.class); }
private void annotationTypes(RamlDocumentBuilder builder, RamlApi modelApi) throws IOException { for (RamlSupportedAnnotation ramlSupportedAnnotation : modelApi.getSupportedAnnotation()) { AnnotationTypeBuilder annotationTypeBuilder = AnnotationTypeBuilder.annotationType(ramlSupportedAnnotation.getAnnotation().getSimpleName()); Class<? extends Annotation> javaAnnotation = ramlSupportedAnnotation.getAnnotation(); if (javaAnnotation.getDeclaredMethods().length > 0) { for (Method method : javaAnnotation.getDeclaredMethods()) { if (method.getReturnType().isArray()) { annotationTypeBuilder.withProperty(property(method.getName(), calculateRamlType(method.getReturnType() .getComponentType()) + "[]")); } else { annotationTypeBuilder.withProperty(property(method.getName(), calculateRamlType(method.getReturnType()) )); } } builder.withAnnotationTypes(annotationTypeBuilder); } } }