P
Phy6
Hi, I am trying to find an easily extended way to write compose
concrete objects for my application.
The objects I am using are all things (nouns) like Customer, Database,
Shop, Task, Year, etc. etc. LOTS of classes like this.
I have GUI components (Tapestry) that display messages regarding the
object or objects.
I want to be able to do something like Customer.plural to get the
String "Customers". I'd like these conjugates available statically,
so no instance is needed (In case the object is null)
I have 4 conjugates for each noun: singular, plural, singular
possessive, plural possessive.
Furthermore, sometimes the GUI components can work on many different
types of these objects, so the class should not be hard-coded in the
component. It should code something like:
Noun.plural to get the String "Customers"
But we can't override static fields.
Of course the concrete classes each have unique fields, along with a
getLabel() method which generates a String for identifying each
instance.
They also have getId() which is a code that uniquely identifies the
object (used for compare,equals,hashcode)
Any Ideas?
concrete objects for my application.
The objects I am using are all things (nouns) like Customer, Database,
Shop, Task, Year, etc. etc. LOTS of classes like this.
I have GUI components (Tapestry) that display messages regarding the
object or objects.
I want to be able to do something like Customer.plural to get the
String "Customers". I'd like these conjugates available statically,
so no instance is needed (In case the object is null)
I have 4 conjugates for each noun: singular, plural, singular
possessive, plural possessive.
Furthermore, sometimes the GUI components can work on many different
types of these objects, so the class should not be hard-coded in the
component. It should code something like:
Noun.plural to get the String "Customers"
But we can't override static fields.
Of course the concrete classes each have unique fields, along with a
getLabel() method which generates a String for identifying each
instance.
They also have getId() which is a code that uniquely identifies the
object (used for compare,equals,hashcode)
Any Ideas?