V
VisionSet
Please comment on this approach to business object and data object:
public interface DataInfo {
public Object[] getData();
}
public class Record implements DataInfo {
public static final int FIELD_ONE = 0;
private String[] data;
public Object[] getData() {
return data;
}
public String getFieldOne() {
return data[FIELD_ONE];
}
}
If I'm in an application layer that requires business knowledge I use the
Record type, otherwise the DataInfo type is used. What are the drawbacks of
this proposal?
I think the usual approach is to use composition, a data object wrapped in a
business object.
TIA
public interface DataInfo {
public Object[] getData();
}
public class Record implements DataInfo {
public static final int FIELD_ONE = 0;
private String[] data;
public Object[] getData() {
return data;
}
public String getFieldOne() {
return data[FIELD_ONE];
}
}
If I'm in an application layer that requires business knowledge I use the
Record type, otherwise the DataInfo type is used. What are the drawbacks of
this proposal?
I think the usual approach is to use composition, a data object wrapped in a
business object.
TIA