/** * Retrieves the default value of a property * * @return the default value of the property */ public Optional<Object> getDefaultValue() { if (property instanceof BooleanProperty) { BooleanProperty booleanProperty = (BooleanProperty) property; return Optional.ofNullable(booleanProperty.getDefault()); } else if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getDefault()); } else if (property instanceof DoubleProperty) { DoubleProperty doubleProperty = (DoubleProperty) property; return Optional.ofNullable(doubleProperty.getDefault()); } else if (property instanceof FloatProperty) { FloatProperty floatProperty = (FloatProperty) property; return Optional.ofNullable(floatProperty.getDefault()); } else if (property instanceof IntegerProperty) { IntegerProperty integerProperty = (IntegerProperty) property; return Optional.ofNullable(integerProperty.getDefault()); } else if (property instanceof LongProperty) { LongProperty longProperty = (LongProperty) property; return Optional.ofNullable(longProperty.getDefault()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getDefault()); } return Optional.empty(); }
if (byte.class == objectClass || Byte.class == objectClass) { swaggerProperty = new StringProperty("byte"); } else if (char.class == objectClass || Character.class == objectClass) { StringProperty property = new StringProperty(); property.setMaxLength(1); swaggerProperty = property; } else if (short.class == objectClass || Short.class == objectClass) { } else if (long.class == objectClass || Long.class == objectClass) { swaggerProperty = new LongProperty(); } else if (float.class == objectClass || Float.class == objectClass) { swaggerProperty = new FloatProperty(); } else if (double.class == objectClass || Double.class == objectClass) { swaggerProperty = new DoubleProperty(); } else if (BigDecimal.class == objectClass) { } else if (boolean.class == objectClass || Boolean.class == objectClass) { swaggerProperty = new BooleanProperty(); } else if (String.class == objectClass) {
return new StringProperty() .required(annotation.required()) .example(annotation.example().isEmpty() ? null : annotation.example()) .description(annotation.value().isEmpty() ? null : annotation.value()); DoubleProperty property = new DoubleProperty(); property.setRequired(annotation.required()); return property .example(annotation.example()) .description(annotation.value()); FloatProperty property = new FloatProperty(); property.setRequired(annotation.required()); return property .example(annotation.example()) .description(annotation.value()); IntegerProperty property = new IntegerProperty(); property.setRequired(annotation.required()); property.setExample(annotation.example()); return property .description(annotation.value()); LongProperty property = new LongProperty(); property.setRequired(annotation.required()); property.setExample(annotation.example()); return property .description(annotation.value());
private static Map<String, Property> initProperties() { Map<String, Property> properties = new LinkedHashMap<>(); properties.put(PROPERTY_ONE_NAME, new StringProperty() .example(PROPERTY_ONE_EXAMPLE) .required(true) .description(PROPERTY_ONE_DESCRIPTION)); properties.put(PROPERTY_TWO_NAME, new StringProperty() .example(PROPERTY_TWO_EXAMPLE) .required(true) .description(PROPERTY_TWO_DESCRIPTION)); IntegerProperty integerProp = new IntegerProperty(); LongProperty longProp = new LongProperty(); BooleanProperty booleanProp = new BooleanProperty(); integerProp.setExample(""); longProp.setExample(""); booleanProp.setExample(""); properties.put(ARRAY_PROP_NAME, new ArrayProperty().example("").description("")); properties.put(DOUBLE_PROP_NAME, new DoubleProperty().example("").description("")); properties.put(FLOAT_PROP_NAME, new FloatProperty().example("").description("")); properties.put(INTEGER_PROP_NAME, integerProp.description("")); properties.put(LONG_PROP_NAME, longProp.description("")); properties.put(BOOLEAN_PROP_NAME, booleanProp.description("")); properties.put(OBJECT_PROP_NAME, new ObjectProperty().example("").description("")); return properties; } }
if (_contains) { _matched=true; _switchResult = new StringProperty(); _switchResult = new BooleanProperty(); if (Objects.equal(typeName, "double")) { _matched=true; _switchResult = new DoubleProperty(); if (Objects.equal(typeName, "float")) { _matched=true; _switchResult = new FloatProperty(); if (Objects.equal(typeName, "integer")) { _matched=true; _switchResult = new IntegerProperty(); if (Objects.equal(typeName, "int")) { _matched=true; _switchResult = new IntegerProperty(); if (Objects.equal(typeName, "long")) { _matched=true; _switchResult = new LongProperty();
public Model getGETModel(Representation rep) { ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { modelImpl .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("fieldNumber", new IntegerProperty()) .property("fieldPart", new StringProperty()) .property("pageNumber", new IntegerProperty()) .property("minOccurs", new IntegerProperty()) .property("maxOccurs", new IntegerProperty()) .property("required", new BooleanProperty()._default(false)) .property("sortWeight", new FloatProperty()) .property("retired", new BooleanProperty()); //FIXME } if (rep instanceof DefaultRepresentation) { modelImpl .property("parent", new RefProperty("#/definitions/FormFormfieldGetRef")) .property("form", new RefProperty("#/definitions/FormGetRef")) .property("field", new RefProperty("#/definitions/FieldGetRef")); } else if (rep instanceof FullRepresentation) { modelImpl .property("parent", new RefProperty("#/definitions/FormFormfieldGet")) .property("form", new RefProperty("#/definitions/FormGet")) .property("field", new RefProperty("#/definitions/FieldGet")); } return modelImpl; }
output = new StringExample(example.toString()); } else { String defaultValue = ((StringProperty)property).getDefault(); List<String> enums = ((StringProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Integer defaultValue = ((IntegerProperty) property).getDefault(); List<Integer> enums = ((IntegerProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Long defaultValue = ((LongProperty) property).getDefault(); Float defaultValue = ((FloatProperty) property).getDefault(); List<Float> enums = ((FloatProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Double defaultValue = ((DoubleProperty) property).getDefault(); Boolean defaultValue = ((BooleanProperty)property).getDefault(); output = new BooleanExample( defaultValue == null ? SAMPLE_BOOLEAN_PROPERTY_VALUE : defaultValue.booleanValue());
public void setProperty(Property property) { setType(property.getType()); this.format = property.getFormat(); if (property instanceof StringProperty) { final StringProperty string = (StringProperty) property; setEnum(string.getEnum()); } else if (property instanceof IntegerProperty) { setEnumValue(((IntegerProperty) property).getEnum()); } else if (property instanceof LongProperty) { setEnumValue(((LongProperty) property).getEnum()); } else if (property instanceof FloatProperty) { setEnumValue(((FloatProperty) property).getEnum()); } else if (property instanceof DoubleProperty) { setEnumValue(((DoubleProperty) property).getEnum()); } else if (property instanceof ArrayProperty) { final ArrayProperty array = (ArrayProperty) property; setItems(array.getItems()); } }
@Override protected FloatProperty create() { return new FloatProperty(); }
@Override public Model toModel(Property property) { if (isType(property)) { final FloatProperty resolved = (FloatProperty) property; final ModelImpl model = createModel(resolved); final Float defaultValue = resolved.getDefault(); if (defaultValue != null) { model.setDefaultValue(defaultValue.toString()); } return model; } return null; } },
public void setDefault(String _default) { this._default(_default); }
if (byte.class == objectClass || Byte.class == objectClass) { swaggerProperty = new StringProperty("byte"); } else if (char.class == objectClass || Character.class == objectClass) { StringProperty property = new StringProperty(); property.setMaxLength(1); swaggerProperty = property; } else if (short.class == objectClass || Short.class == objectClass) { } else if (long.class == objectClass || Long.class == objectClass) { swaggerProperty = new LongProperty(); } else if (float.class == objectClass || Float.class == objectClass) { swaggerProperty = new FloatProperty(); } else if (double.class == objectClass || Double.class == objectClass) { swaggerProperty = new DoubleProperty(); } else if (BigDecimal.class == objectClass) { } else if (boolean.class == objectClass || Boolean.class == objectClass) { swaggerProperty = new BooleanProperty(); } else if (String.class == objectClass) {
return fillProperty(new BooleanProperty(), mapping); return fillProperty(new IntegerProperty(), mapping); return fillProperty(new LongProperty(), mapping); return fillProperty(new FloatProperty(), mapping); return fillProperty(new DoubleProperty(), mapping); return fillProperty(new StringProperty(), mapping);
output = new StringExample(example.toString()); } else { String defaultValue = ((StringProperty)property).getDefault(); List<String> enums = ((StringProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Integer defaultValue = ((IntegerProperty) property).getDefault(); List<Integer> enums = ((IntegerProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Long defaultValue = ((LongProperty) property).getDefault(); Float defaultValue = ((FloatProperty) property).getDefault(); List<Float> enums = ((FloatProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0); Double defaultValue = ((DoubleProperty) property).getDefault(); Boolean defaultValue = ((BooleanProperty)property).getDefault(); output = new BooleanExample( defaultValue == null ? SAMPLE_BOOLEAN_PROPERTY_VALUE : defaultValue.booleanValue());
/** * Retrieves the default value of a property * * @return the default value of the property */ public Optional<Object> getDefaultValue() { if (property instanceof BooleanProperty) { BooleanProperty booleanProperty = (BooleanProperty) property; return Optional.ofNullable(booleanProperty.getDefault()); } else if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getDefault()); } else if (property instanceof DoubleProperty) { DoubleProperty doubleProperty = (DoubleProperty) property; return Optional.ofNullable(doubleProperty.getDefault()); } else if (property instanceof FloatProperty) { FloatProperty floatProperty = (FloatProperty) property; return Optional.ofNullable(floatProperty.getDefault()); } else if (property instanceof IntegerProperty) { IntegerProperty integerProperty = (IntegerProperty) property; return Optional.ofNullable(integerProperty.getDefault()); } else if (property instanceof LongProperty) { LongProperty longProperty = (LongProperty) property; return Optional.ofNullable(longProperty.getDefault()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getDefault()); } return Optional.empty(); }