public static PropertyValueBuilder property(String name) { return new PropertyValueBuilder(name); }
@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)); } }
builder.withProperties(PropertyValueBuilder.propertyOfArray(method.getName(), listString)); } else { builder.withProperties(PropertyValueBuilder.property(method.getName(), toValue(value)));
@Override public KeyValueNode buildNode() { KeyValueNode k = super.buildNode(); for (PropertyValueBuilder property : properties) { k.getValue().addChild(property.buildNode()); } return k; } }
@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; } } } } }
builder.withProperties(PropertyValueBuilder.propertyOfArray(method.getName(), listString)); } else { builder.withProperties(PropertyValueBuilder.property(method.getName(), toValue(value)));
@Override public KeyValueNode buildNode() { if (value != null) { return new KeyValueNodeImpl(new StringNodeImpl(name), value.createNode()); } else { if (subValue != null) { return new KeyValueNodeImpl(new StringNodeImpl(name), subValue.buildNode()); } else { return new KeyValueNodeImpl(new StringNodeImpl(name), new ObjectNodeImpl()); } } }
@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; } } } } }
public static PropertyValueBuilder property(String name, String value) { return new PropertyValueBuilder(name, ValueNodeFactories.create(value)); }
@Override public KeyValueNode buildNode() { KeyValueNode node = super.buildNode(); node.getValue().addChild(new KeyValueNodeImpl(new StringNodeImpl("strict"), new BooleanNode(strict))); if ( ! propertyValues.isEmpty() ) { KeyValueNodeImpl kvn = new KeyValueNodeImpl(new StringNodeImpl("value"), new ObjectNodeImpl()); for (PropertyValueBuilder example : propertyValues) { kvn.getValue().addChild(example.buildNode()); } node.getValue().addChild(kvn); } else { KeyValueNodeImpl kvn = new KeyValueNodeImpl(new StringNodeImpl("value"), new ObjectNodeImpl()); node.getValue().addChild(kvn); } return node; } }
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()) );
public static PropertyValueBuilder propertyOfArray(String name, boolean... values) { return new PropertyValueBuilder(name, ValueNodeFactories.create(values)); }
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()) );
public static PropertyValueBuilder propertyOfArray(String name, String... values) { return new PropertyValueBuilder(name, ValueNodeFactories.create(values)); }
public static PropertyValueBuilder property(String name, long value) { return new PropertyValueBuilder(name, ValueNodeFactories.create(value)); }
public static PropertyValueBuilder property(String name, boolean value) { return new PropertyValueBuilder(name, ValueNodeFactories.create(value)); }
public static PropertyValueBuilder propertyOfArray(String name, long... values) { return new PropertyValueBuilder(name, ValueNodeFactories.create(values)); }