private static void processAllowedValues(AllowableValues allowableValues, AbstractSerializableParameter<?> p) { if (allowableValues == null) { return; } Map<PropertyBuilder.PropertyId, Object> args = allowableValues.asPropertyArguments(); if (args.containsKey(PropertyBuilder.PropertyId.ENUM)) { p.setEnum((List<String>) args.get(PropertyBuilder.PropertyId.ENUM)); } else { if (args.containsKey(PropertyBuilder.PropertyId.MINIMUM)) { p.setMinimum((BigDecimal) args.get(PropertyBuilder.PropertyId.MINIMUM)); } if (args.containsKey(PropertyBuilder.PropertyId.MAXIMUM)) { p.setMaximum((BigDecimal) args.get(PropertyBuilder.PropertyId.MAXIMUM)); } if (args.containsKey(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM)) { p.setExclusiveMinimum((Boolean) args.get(PropertyBuilder.PropertyId.EXCLUSIVE_MINIMUM) ? true : null); } if (args.containsKey(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM)) { p.setExclusiveMaximum((Boolean) args.get(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM) ? true : null); } } }
serializable.setMaximum(BigDecimal.valueOf(Double.valueOf(max.value()))); } else { serializable.setExclusiveMaximum(!max.inclusive());
if(bl != null) { map.put(EXCLUSIVE_MAXIMUM, bl); sp.setExclusiveMaximum(bl);
p.setMaximum(null); args.put(PropertyBuilder.PropertyId.EXCLUSIVE_MAXIMUM, p.isExclusiveMaximum()); p.setExclusiveMaximum(null); Property items = PropertyBuilder.build(p.getType(), p.getFormat(), args); p.type(ArrayProperty.TYPE).format(null).items(items);
protected AbstractSerializableParameter fillParameter(AbstractSerializableParameter parameter, Framework.Mapping<?> mapping) { parameter = parameter.type(targetType(mapping)) .format(format(mapping)) .required(required(mapping)) .description(attach(mapping).desc()) .example(exampleString(mapping)) .items(items(mapping)) ._enum(enums(mapping)); parameter.setPattern(pattern(mapping)); parameter.setMaximum(maximum(mapping)); parameter.setExclusiveMaximum(exclusiveMaximum(mapping)); parameter.setMinimum(minimum(mapping)); parameter.setExclusiveMinimum(exclusiveMinimum(mapping)); return parameter; }
private static void copyFields(AbstractSerializableParameter<?> from, AbstractSerializableParameter<?> to) { copyFields((AbstractParameter) from, (AbstractParameter) to); to.setCollectionFormat(from.getCollectionFormat()); to.setDefault(from.getDefault()); to.setEnum(from.getEnum()); if (from.getExample() != null) { to.setExample(from.getExample().toString()); } to.setExclusiveMaximum(to.isExclusiveMaximum()); to.setExclusiveMinimum(to.isExclusiveMinimum()); to.setFormat(from.getFormat()); to.setItems(from.getItems()); to.setMaximum(from.getMaximum()); to.setMaxItems(from.getMaxItems()); to.setMaxLength(from.getMaxLength()); to.setMinLength(to.getMinLength()); to.setMinimum(from.getMinimum()); to.setMaxItems(from.getMaxItems()); to.setMinLength(from.getMinLength()); to.setMultipleOf(from.getMultipleOf()); to.setType(from.getType()); to.setUniqueItems(from.isUniqueItems()); }