Results 1 to 8 of 8

Thread: Booleans as properites

  1. #1
    Join Date
    Feb 2007
    Location
    Ann Arbor, Michigan
    Posts
    48

    Default Booleans as properites

    I feel like I must be missing it, but I really can't find it. Is there is a simple mechanism, within the XML configuration file, to create a bean of type java.lang.Boolean with a given true/false value? Something like <true/> or <false/> in the same vain as <null/>.

    I know Spring would convert "true" in Boolean("true") if it can get at the argument type information but the case I ran into were non-typed collections (in my case, a map) where a value needs to be a Boolean. So, Spring wasn't able to figure out what the type was supposed to be.

    If such <true/> and <false/> tags don't exist yet I'd like to recommend adding them, even if it's just in the util schema? Thanks!
    Chad

  2. #2
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    <util:constant static-field="java.lang.Boolean.TRUE/>
    <util:constant static-field="java.lang.Boolean.FALSE/>

    Regards,
    Oleksandr

    Quote Originally Posted by daleth View Post
    I feel like I must be missing it, but I really can't find it. Is there is a simple mechanism, within the XML configuration file, to create a bean of type java.lang.Boolean with a given true/false value? Something like <true/> or <false/> in the same vain as <null/>.

    I know Spring would convert "true" in Boolean("true") if it can get at the argument type information but the case I ran into were non-typed collections (in my case, a map) where a value needs to be a Boolean. So, Spring wasn't able to figure out what the type was supposed to be.

    If such <true/> and <false/> tags don't exist yet I'd like to recommend adding them, even if it's just in the util schema? Thanks!

  3. #3
    Join Date
    Feb 2007
    Location
    Ann Arbor, Michigan
    Posts
    48

    Default

    Thanks, that's what I was looking for.
    Chad

  4. #4
    Join Date
    Dec 2007
    Posts
    17

    Default

    I have been going through the Documentation on the Spring .org website, but did not find anything about using these custom tags. Nevertheless, I feel they offer a variety of functionality.

    Can you tell me what DTD do I import to use these <util: tags?
    Where can I read up on <util: and other custom tags?

    Thanks.

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  6. #6
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    1. They are described in the Spring Reference (2.x), see e.g. Appendix A.2.2 in the Spring 2.0.7 Reference.

    2. You shall give up DTD completely and use XML Schema instead, see the same appendix for details.

    3. If you for some reasons can not give up DTD or have to use Spring 1.x then you may use older syntax described in the same section under title "Before ..."


    Quote Originally Posted by jaspreet_inc View Post
    I have been going through the Documentation on the Spring .org website, but did not find anything about using these custom tags. Nevertheless, I feel they offer a variety of functionality.

    Can you tell me what DTD do I import to use these <util: tags?
    Where can I read up on <util: and other custom tags?

    Thanks.

  7. #7
    Join Date
    Dec 2007
    Posts
    17

    Default

    Thank you.

    And theres some here as well outlining the exact util and the XSDs involved, just found it out.

    http://static.springframework.org/sp...y-schemas-util

  8. #8
    Join Date
    Dec 2007
    Posts
    17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •