Announcement Announcement Module
Collapse
No announcement yet.
Booleans as properites Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

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

    Regards,
    Oleksandr

    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!

    Comment


    • #3
      Thanks, that's what I was looking for.

      Comment


      • #4
        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.

        Comment


        • #5
          There's some information on this here.
          http://static.springframework.org/sp...-configuration
          http://static.springframework.org/sp...sd-config.html
          http://static.springframework.org/sp...y-schemas-util

          Comment


          • #6
            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 ..."


            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.

            Comment


            • #7
              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

              Comment


              • #8
                Thanks guys.

                Comment

                Working...
                X