The castor examples concentrate on classes defined in terms of 
primitives like this
        class Person
        {
                int age;
                String name;
                String street;
        }

  I'm trying to build XML marshallers/unmarshalers for legacy classes 
that eschew primitive classes in favor of application-specific field 
types, like this:
        class Person
        {
                Age age;
                Name name;
                Street street;
        }
where Age, Name, Street are subclasses of AbstractField. These have 
one-arg constructors for the relevant primitive types; e.g. new 
Age(23), new Age("23"), new Name("Foo"), and so forth, provide no 
public default (no-args) constructors, and often declare their 
internal vars as final. Higher-level legacy classes (like Person) 
lack getter/setter methods too, and tend to be written like this:
        class Person
        {
                final Age age;
                final Name name;
                final Street street;
        }
        private Person(Age age, Name name, Street street)
        {
                this.age = age;
                this.name = name;
                this.street = street;
        }

Constructors are used ONLY to instantiate objects in RAM. Separate 
methods are provided to load/save objects to the DBMS. The latter are 
generally public and call the above constructor internally, which is 
why the constructor above is private.
        public static load(JdbcCtx ctx, ID primaryKey) { }
        public void save(JdbcCtx ctx) {}

Could please outline how to approach this in Castor, if possible 
without adding public constructors and getter/setter methods to every 
class? I'd prefer to restrict the number of public get/set methods to 
only those required by the application rather than exposing 
everything to fit with the marshalling framework. This preference 
could of course be relaxed, but I'd like to minimize the upheaval if 
possible.
-- 
Brad Cox, PhD; [EMAIL PROTECTED] 703 361 4751
o For industrial age goods there were checks and credit cards.
    For everything else there is http://virtualschool.edu/mybank
o Java Interactive Learning Environment http://virtualschool.edu/jile
o Java Web Application Architecture: http://virtualschool.edu/jwaa

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to