I'm having trouble understanding what it is you're trying to do. What is
the relationship between Item and InventoryClass? Is it a "has a" or "is
a" relationship. If it is "is a" then you want Item to extend (or
implement) InventoryClass. What classes are you thinking about using for
E when you instantiate InventoryClass?
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of James Perkins
Sent: Friday, March 06, 2009 1:04 PM
To: Java Programming on and around the iSeries / AS400
Subject: Java and OO Concepts
Hi All,
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 class
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.
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.
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.