there has been major disruption to email systems caused by the latest windoz virus so maybe it got lost.
i think i have a quick solution to your problem. (the documentation probably isn't too clear on this point but) betwixt requires a different betwixt file for each different class. (being able to write navigable objects in the primary betwixt file is on the todo list but probably needs the refactoring being done on the branch to be completed.)
change the PersonInt.betwixt to something like
<?xml version="1.0" ?>
<info primitiveTypes="attribute">
<element name="person">
<addDefaults/>
</element>
</info>and add an AddressInt.betwixt something like:
<?xml version="1.0" ?>
<info primitiveTypes="attribute">
<element name="address">
<attribute name="street1" property="street1"/>
<attribute name="postalcode" property="postalcode"/>
</element>
</info>(or alternatively, you could probably just use a custom name mapper to strip the Int from each interface class.)
- robert
On 28 Jan 2004, at 14:38, Cheong Chung Onn wrote:
Hi, resending... i haven't seen it on the mailing list since i last posted 11 hours ago.
cheongco wrote:
>Hi Robert,
>
>Thanks for looking into the matter, here are the files you requested and they'll enable u to test immediately :) Btw, i have any another related question using the same set of files when this matter is resolved.
>
>Thanks once again.
>chung-onn
>
>===Person.betwixt===
><?xml version="1.0" ?>
><info primitiveTypes="attribute">
> <hide property="address"/>
> <element name="person">
> <element name="address">
> <attribute name="street1" property="street1"/>
> <attribute name="postalcode" property="postalcode"/>
> </element>
> <addDefaults/>
> </element>
></info>
>
>===PersonInt.betwixt (same as above)===
><?xml version="1.0" ?>
><info primitiveTypes="attribute">
> <hide property="address"/>
> <element name="person">
> <element name="address">
> <attribute name="street1" property="street1"/>
> <attribute name="postalcode" property="postalcode"/>
> </element>
> <addDefaults/>
> </element>
></info>
>
>===AddressIntf.java===
>public interface AddressIntf {
> public String getStreet1();
> public int getPostalcode();
> public void setStreet1(String st);
> public void setPostalcode(int pc);
>
> //convenience method
> public void setAddress(String st, int pc);
>
>}
>
>===PersonIntf.java===
>
>public interface PersonIntf extends AddressIntf{
> public String getName();
> public int getAge();
> public void setName(String name);
> public void setAge(int age);
>
> //derive attr
> public AddressIntf getAddress();
>}
>
>===Person.java===
>public class Person implements PersonIntf {
>
> private String name;
> private int age;
> private Address address;
>
> /** Need to allow bean to be created via reflection */
> /** Creates a new instance of Person */
> public Person() {address = new Address();}
>
> public Person(String name, int age) {
> this(name, age, null, 0);
> }
>
> public Person(String name, int age, String street1, int postalcode){
> this.name = name;
> this.age = age;
> this.address = new Address(street1, postalcode);
> }
>
> public String getName() { return name;}
> public void setName(String name) {this.name = name;}
>
> public int getAge() {return age;}
> public void setAge(int age) {this.age = age;}
>
> public AddressIntf getAddress() {return address;}
> public void setAddress(Address address) {this.address=address;}
> public void setAddress(String st, int pc) {address.setAddress(st, pc);}
>
> public String getStreet1(){ return address.getStreet1();}
> public void setStreet1(String st){ address.setStreet1(st);}
>
> public int getPostalcode(){ return address.getPostalcode();}
> public void setPostalcode(int pc){address.setPostalcode(pc);}
>
> public String toString() {return "PersonBean[name='" + name + "',age='" + age + ", address[" + address +"']";}
>
> private class Address implements AddressIntf {
> private String street1;
> private int postalcode;
>
> /** Creates a new instance of Name */
> public Address() {}
>
> public Address(String street1, int postalcode){
> this.street1=street1;
> this.postalcode=postalcode;
> }
>
> public String getStreet1() {return street1;}
> public void setStreet1(String street1) {this.street1 = street1;}
>
> public int getPostalcode() {return postalcode;}
>
> public void setPostalcode(int postalcode) {this.postalcode = postalcode;}
>
> public void setAddress(String street1, int postalcode){
> this.street1=street1;
> this.postalcode=postalcode;
> }
>
> public String toString(){return "street1="+street1+", postalcode="+postalcode;}
>
> }
>}
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
