@Override public TypeBuilder getRamlSyntax() { String format = foundType.formats.get(type); if ( format == null ) { return foundType.getRamlSyntax(); } else { return foundType.getRamlSyntax().with(PropertyValueBuilder.property("format", format)); } }
} else { builder.withProperties(PropertyValueBuilder.property(method.getName(), toValue(value)));
@Override public void emit(RamlProperty ramlProperty) throws IOException { if (!ramlProperty.isRamlScalarType()) { try { PropertyValueBuilder property = PropertyValueBuilder.property(ramlProperty.getName()); propertyValues.peek().withPropertyValue(property); propertyValues.push(property); // ramlType.emit(this); } finally { propertyValues.pop(); } } else { Optional<Example> e = ramlProperty.getAnnotation(Example.class); if (e.isPresent()) { if (e.get().useCase().equals(currentCaseName)) { propertyValues.peek().withPropertyValue(PropertyValueBuilder.property(ramlProperty.getName(), e.get().value())); return; } } Optional<Examples> examplesAnnotation = ramlProperty.getAnnotation(Examples.class); if (examplesAnnotation.isPresent()) { for (Example example : examplesAnnotation.get().value()) { if (example.useCase().equals(currentCaseName)) { propertyValues.peek().withPropertyValue(PropertyValueBuilder.property(ramlProperty.getName(), example.value())); return; } } } } }
} else { builder.withProperties(PropertyValueBuilder.property(method.getName(), toValue(value)));
@Override public void emit(RamlProperty ramlProperty) throws IOException { if (!ramlProperty.isRamlScalarType()) { try { PropertyValueBuilder property = PropertyValueBuilder.property(ramlProperty.getName()); propertyValues.peek().withPropertyValue(property); propertyValues.push(property); // ramlType.emit(this); } finally { propertyValues.pop(); } } else { Optional<Example> e = ramlProperty.getAnnotation(Example.class); if (e.isPresent()) { if (e.get().useCase().equals(currentCaseName)) { propertyValues.peek().withPropertyValue(PropertyValueBuilder.property(ramlProperty.getName(), e.get().value())); return; } } Optional<Examples> examplesAnnotation = ramlProperty.getAnnotation(Examples.class); if (examplesAnnotation.isPresent()) { for (Example example : examplesAnnotation.get().value()) { if (example.useCase().equals(currentCaseName)) { propertyValues.peek().withPropertyValue(PropertyValueBuilder.property(ramlProperty.getName(), example.value())); return; } } } } }
PropertyValueBuilder.property("default", parameter.getDefaultValue().get()), PropertyValueBuilder.property("required", false) ); } else if (parameter.getAnnotation(NotNull.class).isPresent()) { parameterBuilder.with( PropertyValueBuilder.property("required", true) ); if (parameter.getAnnotation(Min.class).isPresent()) { parameterBuilder.with( PropertyValueBuilder.property("minimum", parameter.getAnnotation(Min.class).get().value()) PropertyValueBuilder.property("maximum", parameter.getAnnotation(Max.class).get().value()) ); if (ramlType.get() == ScalarType.STRING) { parameterBuilder.with( PropertyValueBuilder.property("minLength", parameter.getAnnotation(Size.class).get().min()), PropertyValueBuilder.property("maxLength", parameter.getAnnotation(Size.class).get().max()) );
PropertyValueBuilder.property("default", parameter.getDefaultValue().get()), PropertyValueBuilder.property("required", false) ); } else if (parameter.getAnnotation(NotNull.class).isPresent()) { parameterBuilder.with( PropertyValueBuilder.property("required", true) ); if (parameter.getAnnotation(Min.class).isPresent()) { parameterBuilder.with( PropertyValueBuilder.property("minimum", parameter.getAnnotation(Min.class).get().value()) PropertyValueBuilder.property("maximum", parameter.getAnnotation(Max.class).get().value()) ); if (ramlType.get() == ScalarType.STRING) { parameterBuilder.with( PropertyValueBuilder.property("minLength", parameter.getAnnotation(Size.class).get().min()), PropertyValueBuilder.property("maxLength", parameter.getAnnotation(Size.class).get().max()) );