protected void copyAccessors(Schema schema) { SchemaFactory parentSchemaFactory = schemaFactory; Class<?> clz = parentSchemaFactory.getSchemaClass(schema.getId()); if (clz == null) { return; } schemaClasses.put(schema.getId().toLowerCase(), clz); Schema parentSchema = parentSchemaFactory.getSchema(clz); for (Map.Entry<String, Field> entry : schema.getResourceFields().entrySet()) { ((FieldImpl) entry.getValue()).setName(entry.getKey()); Field parentField = parentSchema.getResourceFields().get(entry.getKey()); if (parentField == null || !(parentField instanceof FieldImpl)) { continue; } ((FieldImpl) entry.getValue()).setReadMethod(((FieldImpl) parentField).getReadMethod()); } }
Field oldField = existingFields.put(entry.getKey(), entry.getValue()); if (oldField instanceof FieldImpl) { ((FieldImpl)entry.getValue()).setReadMethod(((FieldImpl) oldField).getReadMethod()); ((FieldImpl)entry.getValue()).setAttributes(oldField.getAttributes());
public FieldImpl(Field field) { this.name = field.getName(); this.description = field.getDescription(); this.validChars = field.getValidChars(); this.invalidChars = field.getInvalidChars(); this.create = field.isCreate(); this.readOnCreateOnly = field.isReadOnCreateOnly(); this.transform = field.getTransform(); this.update = field.isUpdate(); this.includeInList = field.isIncludeInList(); this.nullable = field.isNullable(); this.unique = field.isUnique(); this.required = field.isRequired(); this.min = field.getMin(); this.max = field.getMax(); this.minLength = field.getMinLength(); this.maxLength = field.getMaxLength(); this.defaultValue = field.getDefault(); this.options = field.getOptions() == null ? null : new ArrayList<String>(field.getOptions()); this.displayIndex = field.getDisplayIndex(); this.attributes = new HashMap<String, Object>(field.getAttributes()); if (field instanceof FieldImpl) { this.readMethod = ((FieldImpl)field).getReadMethod(); this.defaultIsNull = ((FieldImpl)field).isDefaultIsNull(); } setType(field.getType()); }