/** * 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(); }
/** * 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(); }
payload.append("\"@ignore@\""); } else if (property instanceof StringProperty) { if (StringUtils.hasText(((StringProperty) property).getPattern())) { payload.append("\"@matches(").append(((StringProperty) property).getPattern()).append(")@\""); } else if (!CollectionUtils.isEmpty(((StringProperty) property).getEnum())) { payload.append("\"@matches(").append(((StringProperty) property).getEnum().stream().collect(Collectors.joining("|"))).append(")@\"");
protected DataProvider collectStringProperty(Swagger swagger, StringProperty schema, boolean clean) { return gen(() -> { StringProperty.Format uriFormat = StringProperty.Format.fromName(schema.getFormat()); if (uriFormat == StringProperty.Format.URI || uriFormat == StringProperty.Format.URL) return faker.internet().url(); else if (!isEmpty(schema.getPattern())) { Generex generex = new Generex(schema.getPattern()); return generex.random(); } else return faker.lorem().word(); }); }
break; case "pattern": _switchResult = prop.getPattern(); break;
result.setPattern(sp.getPattern());
public EmailProperty(StringProperty prop) { this(); this._enum = prop.getEnum(); this.minLength = prop.getMinLength(); this.maxLength = prop.getMaxLength(); this.pattern = prop.getPattern(); this.name = prop.getName(); this.type = prop.getType(); this.example = prop.getExample(); this._default = prop.getDefault(); this.xml = prop.getXml(); this.required = prop.getRequired(); this.position = prop.getPosition(); this.description = prop.getDescription(); this.title = prop.getTitle(); this.readOnly = prop.getReadOnly(); }
result.setPattern(sp.getPattern());
result.setPattern(sp.getPattern());
model.setPattern(stringProperty.getPattern()); model.setMinLength(stringProperty.getMinLength()); model.setMaxLength(stringProperty.getMaxLength());