Hi,

Advantage of FieldHandler is that you don't need to modify original class. 

BTW, the tip from Sudhendra helped.

Thanks,
Kiran

-----Original Message-----
From: Crasnier St�phane [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 26, 2004 12:05 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Using FieldHandler?



Hi,
Instead of using a FieldHandler, I prefer performing the mapping in the 
getter/setter like :

protected final static String PERMITTED = "Permitted";

protected final static String DENY = "Deny";

protected String myField;

public void setFooBoolean(boolean _boolean)
{
       // May be the contrary...
        myField = _boolean ? PERMITTED : DENY;
}

public boolean getFooBoolean()
{
    // May be the contrary...
    return myField.equals(PERMITTED);
}

I don't know if it is a correct way (May be not ?) but it works and is 
less costing.
Hope it will be helpful.
Best regards,
St�phane.


Gawde, Kiran a �crit :

> Hi,
>  
> How can I use FieldHandler? I need to map a java.lang.Boolean field to
> string ("Deny" or "Permitted"). Any samples?
>  
> Thanks,
> Kiran Gawde
>  
>
>-----------------------------------------------------------------------
>-
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-dev
>  
>



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

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

Reply via email to