@Override public SchemaMetadataV3 fillFromImpl(SchemaMetadata impl) { PojoUtils.copyProperties(this, impl, PojoUtils.FieldNaming.CONSISTENT, new String[] {"fields"}); this.fields = new FieldMetadataV3[impl.fields.size()]; this.label = impl.name; int i = 0; for (SchemaMetadata.FieldMetadata f : impl.fields) this.fields[i++] = new FieldMetadataV3().fillFromImpl(f); // TODO: version! return this; }
@Override public GrepModelOutputV3 fillFromImpl(GrepModel.GrepOutput impl) { PojoUtils.copyProperties(this, impl, PojoUtils.FieldNaming.ORIGIN_HAS_UNDERSCORES); return this; }
@Override public GrepModel.GrepOutput createImpl() { GrepModel.GrepOutput impl = new GrepModel.GrepOutput(null); PojoUtils.copyProperties(impl, this, PojoUtils.FieldNaming.DEST_HAS_UNDERSCORES); return impl; }
/** * Copy properties "of the same name" from one POJO to the other. If the fields are named * consistently (both sides have fields named "_foo" and/or "bar") this acts like Apache Commons * PojoUtils.copyProperties(). If one side has leading underscores and the other does not then the * names are conformed according to the field_naming parameter. * * @param dest Destination POJO * @param origin Origin POJO * @param field_naming Are the fields named consistently, or does one side have underscores? * @param skip_fields Array of origin or destination field names to skip */ public static void copyProperties( Object dest, Object origin, FieldNaming field_naming, String[] skip_fields) { copyProperties(dest, origin, field_naming, skip_fields, null); }
/** * Copy properties "of the same name" from one POJO to the other. If the fields are named * consistently (both sides have fields named "_foo" and/or "bar") this acts like Apache Commons * PojoUtils.copyProperties(). If one side has leading underscores and the other does not then the * names are conformed according to the field_naming parameter. * * <p>It is also able to map fields between external types like Schema to their corresponding * internal types. * * @param dest Destination POJO * @param origin Origin POJO * @param field_naming Are the fields named consistently, or does one side have underscores? */ public static void copyProperties(Object dest, Object origin, FieldNaming field_naming) { copyProperties(dest, origin, field_naming, null); }