/** * 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(); }
/** * Retrieves the maxLength of a property * * @return the maxLength of the property */ public Optional<Integer> getMaxlength() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getMaxLength()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getMaxLength()); } return Optional.empty(); }
/** * Retrieves the minLength of a property * * @return the minLength of the property */ public Optional<Integer> getMinlength() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getMinLength()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getMinLength()); } return Optional.empty(); }
switch (attr) { case "default": _switchResult = prop.getDefault(); break; case "enum": _switchResult = prop.getEnum(); break; case "minLength": _switchResult = prop.getMinLength(); break; case "maxLength": _switchResult = prop.getMaxLength(); break; case "pattern": _switchResult = prop.getPattern(); break;
String defaultValue = ((UUIDProperty)property).getDefault(); List<String> enums = ((UUIDProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0);
@Override protected UUIDProperty create() { return new UUIDProperty(); }
protected Property getPrimitiveProperty(String type) { String primitiveType = type; if (type.contains(".")) { primitiveType = primitiveType.substring(primitiveType.lastIndexOf(".") + 1).toLowerCase(); } switch (primitiveType) { case "boolean": return new BooleanProperty().example(true); case "float": case "double": return new DoubleProperty().example("3.14"); case "byte": case "short": case "int": case "integer": return new IntegerProperty().example(42); case "long": return new LongProperty().example(Long.MAX_VALUE >> 4); case "date": return new DateProperty().example("2005-14-10T13:17:42.16Z"); case "uuid": UUIDProperty uuidProp = new UUIDProperty(); uuidProp.setExample("19474a3b-99b5-482e-9e77-852be9adf817"); return uuidProp; case "string": return new StringProperty().example("String"); default: return null; } }
/** * Retrieves the pattern of a property * * @return the pattern of the property */ public Optional<String> getPattern() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getPattern()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getPattern()); } return Optional.empty(); }
String defaultValue = ((UUIDProperty)property).getDefault(); List<String> enums = ((UUIDProperty) property).getEnum(); if( enums != null && !enums.isEmpty()) { defaultValue = enums.get(0);
} else if (UUID.class == objectClass) { swaggerProperty = new UUIDProperty(); } else if (objectClass.isEnum()) {
/** * Retrieves the pattern of a property * * @return the pattern of the property */ public Optional<String> getPattern() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getPattern()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getPattern()); } return Optional.empty(); }
@Override public Model toModel(Property property) { if (isType(property)) { final UUIDProperty resolved = (UUIDProperty) property; final ModelImpl model = createModel(resolved); model.setDefaultValue(resolved.getDefault()); return model; } return null; } },
} else if (UUID.class == objectClass) { swaggerProperty = new UUIDProperty(); } else if (objectClass.isEnum()) {
/** * Retrieves the minLength of a property * * @return the minLength of the property */ public Optional<Integer> getMinlength() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getMinLength()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getMinLength()); } return Optional.empty(); }
/** * Retrieves the maxLength of a property * * @return the maxLength of the property */ public Optional<Integer> getMaxlength() { if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; return Optional.ofNullable(stringProperty.getMaxLength()); } else if (property instanceof UUIDProperty) { UUIDProperty uuidProperty = (UUIDProperty) property; return Optional.ofNullable(uuidProperty.getMaxLength()); } return Optional.empty(); }
/** * 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(); }
return fillProperty(new UUIDProperty(), mapping);