@Override public int hashCode() { return Objects.hashCode(super.getHashCode(), getDefaultValue(), getType()); }
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()); } }
} else { return SchemaProperty.create(name, fieldName, type.getName(), desc, source.isFinal(), source.getEnums(), conversion.convert(source.getDefaultValue(), String.class), indexed);
private static void validateProperties(Bean bean) { Schema schema = bean.getSchema(); for (SchemaProperty prop : schema.get(SchemaProperty.class)) { String value = validateSingle(bean, prop); if (value == null) { continue; } try { conversion.convert(value, forName(prop.getType())); } catch (Exception e) { throw Events.CFG105_WRONG_PROPERTY_TYPE(bean.getId(), prop.getName(), prop.getType(), value); } } }
public Schema.SchemaProperty toSchema() { return Schema.SchemaProperty.create(getName(), getFieldName(), getType(), getDesc(), isImmutable(), getEnums(), getDefaultValue(), false); } }
@Override public int hashCode() { return Objects.hashCode(super.getHashCode(), getDefaultValue(), getType()); }
/** * Not to be used by users. */ public static SchemaProperty create(final String name, final String fieldName, final String type, final String desc, final boolean isImmutable, final List<String> enums, final String defaultValue, final boolean indexed) { return new SchemaProperty(name, fieldName, type, desc, isImmutable, enums, defaultValue, indexed); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaProperty)) { return false; } SchemaProperty o = (SchemaProperty) obj; return super.equals(o) && equal(getDefaultValue(), o.getDefaultValue()) && equal(getType(), o.getType()); } }
public String toString() { return super.toStringHelper(SchemaProperty.class).add("type", getType()) .add("defaultValue", getDefaultValue()).toString(); }
public SchemaProperty(Schema.SchemaProperty schema) { super(schema); this.defaultValue = schema.getDefaultValue(); this.type = schema.getType(); this.enums = schema.getEnums(); }
public String toString() { return super.toStringHelper(SchemaProperty.class).add("type", getType()) .add("defaultValue", getDefaultValue()).toString(); }
private void convertProperty(Bean source, Map<String, Object> values) { for (SchemaProperty prop : source.getSchema().get(SchemaProperty.class)) { String value = source.getSingleValue(prop.getName()); String field = prop.getFieldName(); Object converted = conversion.convert(value, loadClass(prop.getType())); values.put(field, converted); } }
/** * Not to be used by users. */ public static SchemaProperty create(final String name, final String fieldName, final String type, final String desc, final boolean isImmutable, final List<String> enums, final String defaultValue, final boolean indexed) { return new SchemaProperty(name, fieldName, type, desc, isImmutable, enums, defaultValue, indexed); }
@Override public boolean equals(Object obj) { if (!(obj instanceof SchemaProperty)) { return false; } SchemaProperty o = (SchemaProperty) obj; return super.equals(o) && equal(getDefaultValue(), o.getDefaultValue()) && equal(getType(), o.getType()); } }