Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6298503

RFE: "mandatory" or "required" annotation for bean properties

XMLWordPrintable

    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      Would it make sense to add "required" or "mandatory" annotation that can be used for "set" methods for JavaBeans to indicate that the property is required. This may or may not reflect in other JavaBeans interfaces.

      JUSTIFICATION :
      Frameworks such as Spring and JMX can benifit from such annotation and will reduce amount of initialization code. It will also allow to decouple the beans initialization from a specific framework by avoiding implementation of the initialization interfaces.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      class X {
        @Required
        public setDataSource(DataSource ds) {
          ...
        }
      }

      Framework (such as Spring), when instatntiating bean, can check if all required bean properties have been configured.
      ###@###.### 2005-07-19 00:10:59 GMT

            malenkov Sergey Malenkov (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: