Title: Message
AFAIK, castor still not support Map in collelction field. You can use it but both key and value will be used as value.
By idea, the Map must map object list to id -> object map, but now castor not support this. I'll not recomended use it now. Wait for good time.
Thanks!
-----Original Message-----
From: Conor Allen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 1:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] : How do I handle java.util.Properties

You would use the property helper internally in the class the had a Properties object you wanted to marshall/unparshall/persist/materialize.

 

Castor only knows about a collection of property objects which it can use and you can continue to use the java.util.Property object.

 

It is really a bit of a hack.

 

i.e.

 

public classs SomeClass

{

            private Properties props = new Properties();

            public Collection getProperties()

            {

                        return PropertyHelper.getPropertyCollection(props);

}

public void setProperties(Collection properties)

{

            this.props = PropertyHelper.getProperties(properties);

}

}

 

Conor

-----Original Message-----
From: Angelo Giugliano [mailto:[EMAIL PROTECTED]]
Sent
:
22 January 2003 11:47
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] : How do I handle java.util.Properties

 

Hi Conor

 

First thank you for the helping hand but I don't understand PropertyHelper's usage. I believe that:

 

My class has:

 

public Collection getProperty() .....

public void setProperty....

 

Ok But what is role's PropertyHelper for a client?

And the file mapping?How will be?

Perhaps:

 

MyTestClient.java:

 

..................

..................

Properties p = new Properties();

p.setProperty(key,value);

PropertyHelper ph = new PropertyHelper();

ph.getPropertyCollection(p);

.................

 

And then?

 

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

----- Original Message -----

From: Conor Allen

Sent: Tuesday, January 21, 2003 9:36 PM

Subject: Re: [castor-dev] : How do I handle java.util.Properties

 

I am by no means an expert but you could try this:

 

Create a Property class  that holds two values, a String key and a String value and a helper class to convert between a collection of Property objects and a Properties object and vice versa (see attached classes).

 

Your class can the provide getters and setters for a collection of Property objects which castor can marshal/persist and you can use to initialize the state of your object.

 

There may be a cleaner way though.

 

Anybody?

 

Conor

 

-----Original Message-----
From: Angelo Giugliano [mailto:[EMAIL PROTECTED]]
Sent:
21 January 2003 16:16
To:
[EMAIL PROTECTED]
Subject: [castor-dev] : How do I handle java.util.Properties

 

Hello, Castor experts

My name is Angelo and I have a problem with my application.

How do I handle java.util.Properties? I can't use Hashtable because key =
or value can be null.

      
          I have Java Classes that contain "Properties".
      
       a) How do I write a mapping.xml to map both the key
       and value of a Properties?
      
       b) Any recommended way to write the XML instace file
       to represent Properties:
          . The key should be an attribute and the value the
       nodeValue For example:
            For a person named Angelo who is of age 34:  
            <Person name=3D"Angelo">34</Person>
      
        or
      
           <Person>
            <name> Angelo </name>
             <age> 34 </age>
            </Person>
      
       The examples do
       not talk about Properties - only "collection/List". I
       could also not find any answer in the archives.
      =
       Thanks,
       Angelo

--

This e-mail is confidential and is intended for the named recipient only. If
you receive it in error please destroy the message and all copies. Kainos
Software Ltd. does not accept liability for damage sustained as a result of
malicious software (e.g. viruses). Kainos does not accept liability for, or
permit, the creation of contracts on its behalf by e-mail, the publication of
any defamatory statement by its employees by e-mail, or changes subsequently
made to the original message. The Company's registered office is located at
4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland, Tel +44 28 9057 1100.

--

This e-mail is confidential and is intended for the named recipient only. If
you receive it in error please destroy the message and all copies. Kainos
Software Ltd. does not accept liability for damage sustained as a result of
malicious software (e.g. viruses). Kainos does not accept liability for, or
permit, the creation of contracts on its behalf by e-mail, the publication of
any defamatory statement by its employees by e-mail, or changes subsequently
made to the original message. The Company's registered office is located at
4-6 Upper Crescent, Belfast, BT7 1NT, Northern Ireland, Tel +44 28 9057 1100.

Reply via email to