|
Hi All,This is most likely a Data Transfer Object you are creating here (http://en.wikipedia.org/wiki/Data_Transfer_Object) so you would build an object only with fields and getters and setters for those.
Just looking for a little advice here. I'm trying to (still) wrap my head
around OO design.
I'm working on an application for order entry. I want to take a list of
items and turn them into an order. Not really a big deal, but just the high
level overview.
I have a class Item that looks something like this, mainly the properties is
where my question is.
public class Item {
private boolean active;
private String description;
private int inventoryClass;
private String ean;
private int inventorySubclass;
private String itemNumber;
private String keywords;
private String uom;
private String upc;
private double weight;
...
}
I'm wondering now, if inventoryClass should now be a new classGenerally there is only need for generics if you know you'll be handling multiple objects of (almost) the same type where the actual type is unknown at design time (like lists and so on).
InventoryClass same with inventorySubclass and uom. Make it more generic has
I could make it more generic like so:
public final class InventoryClass<E> {
private final E inventoryClass;
public InventoryClass(E inventoryClass) {
this.inventoryClass = inventoryClass;
}
public final E getInventoryClass() {
return inventoryClass;
}
}
So, my question is this. Am I heading down the right track? Am I thinking to
RPG/procedural programming like?
Any advice is welcome.I'd like to see it for sure. I am not quite sure what you are doing, but always willing to learn :)
Thanks in advance,
--
James R. Perkins
P.S.
If anybody is interested I have created a List factory class that will
return a generic version of a List without having to infer the generics on
the static factory method.
Example:
List<String> list = newArrayList();
If anybody is interested, I'm willing to share. I'm almost done with a Map
one too.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.