@Override public int hashCode() { return Objects.hashCode(super.getHashCode(), getType(), getCollectionType()); }
public String toString() { return Objects.toStringHelper(SchemaPropertyList.class) .add("type", getCollectionType()).add("collectionType", getCollectionType()) .add("defaultValue", getDefaultValues()).toString(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaPropertyList)) { return false; } SchemaPropertyList o = (SchemaPropertyList) obj; return equals(o) && equal(getCollectionType(), o.getCollectionType()) && equal(getType(), o.getType()); } }
List<String> defaultValues = new ArrayList<>(converted); return SchemaPropertyList.create(name, fieldName, type.getName(), desc, source .isFinal(), source.getEnums(), defaultValues, source.getCollRawType() .getName(), indexed);
public JaxrsSchema(Schema schema) { this.schemaName = schema.getName(); this.className = schema.getType(); this.desc = schema.getDesc(); this.idName = schema.getId().getName(); this.idDesc = schema.getId().getDesc(); this.singleton = schema.getId().isSingleton(); for (Schema.SchemaProperty prop : schema.get(Schema.SchemaProperty.class)) { property.add(new SchemaProperty(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyList prop : schema.get(Schema.SchemaPropertyList.class)) { propertyList.add(new SchemaPropertyList(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRef prop : schema.get(Schema.SchemaPropertyRef.class)) { propertyRef.add(new SchemaPropertyRef(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRefList prop : schema.get(Schema.SchemaPropertyRefList.class)) { propertyRefList.add(new SchemaPropertyRefList(prop)); propertyNames.add(prop.getName()); } for (Schema.SchemaPropertyRefMap prop : schema.get(Schema.SchemaPropertyRefMap.class)) { propertyRefMap.add(new SchemaPropertyRefMap(prop)); propertyNames.add(prop.getName()); } }
private static void validatePropertyList(Bean bean) { Schema schema = bean.getSchema(); for (SchemaPropertyList prop : schema.get(SchemaPropertyList.class)) { List<String> values = bean.getValues(prop.getName()); if (values == null) { continue; } for (String value : values) { try { conversion.convert(value, forName(prop.getType())); } catch (Exception e) { throw Events.CFG105_WRONG_PROPERTY_TYPE(bean.getId(), prop.getName(), prop.getType(), value); } } } }
private void convertPropertyList(Bean source, Map<String, Object> values) { for (SchemaPropertyList prop : source.getSchema().get(SchemaPropertyList.class)) { List<String> vals = source.getValues(prop.getName()); String field = prop.getFieldName(); if (vals == null) { continue; } Collection<Object> c = newCollection(loadClass(prop.getCollectionType())); for (String val : vals) { Object converted = conversion.convert(val, loadClass(prop.getType())); c.add(converted); } values.put(field, c); } }
@Override public int hashCode() { return Objects.hashCode(super.getHashCode(), getType(), getCollectionType()); }
public Schema.AbstractSchemaProperty toSchema() { return Schema.SchemaPropertyList.create(getName(), getFieldName(), getType(), getDesc(), isImmutable(), getEnums(), getDefaultValues(), getCollectionType(), false); } }
/** * Not to be used by users. */ public static SchemaPropertyList create(final String name, final String fieldName, final String type, final String desc, boolean isImmutable, final List<String> enums, List<String> defaultValues, final String collectionType, final boolean indexed) { return new SchemaPropertyList(name, fieldName, type, desc, isImmutable, enums, collectionType, defaultValues, indexed); }
public SchemaPropertyList(Schema.SchemaPropertyList schema) { super(schema); this.type = schema.getType(); this.collectionType = schema.getCollectionType(); this.defaultValues = schema.getDefaultValues(); this.enums = schema.getEnums(); }
/** * Not to be used by users. */ public static SchemaPropertyList create(final String name, final String fieldName, final String type, final String desc, boolean isImmutable, final List<String> enums, List<String> defaultValues, final String collectionType, final boolean indexed) { return new SchemaPropertyList(name, fieldName, type, desc, isImmutable, enums, collectionType, defaultValues, indexed); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaPropertyList)) { return false; } SchemaPropertyList o = (SchemaPropertyList) obj; return equals(o) && equal(getCollectionType(), o.getCollectionType()) && equal(getType(), o.getType()); } }
public String toString() { return Objects.toStringHelper(SchemaPropertyList.class) .add("type", getCollectionType()).add("collectionType", getCollectionType()) .add("defaultValue", getDefaultValues()).toString(); }