Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3049

CompoundPropertyModel constructor allows misuse of model object

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.4.12, 1.5-M2.1
    • 1.5-M3
    • wicket
    • None
    • all

    Description

      Right now the constructor of CompoundPropertyModel is as follows:

      /**

      • Constructor
        *
      • @param object
      • The model object, which may or may not implement IModel
        */
        public CompoundPropertyModel(final Object object) { target = object; }

        which allows users to do something like:

        new CompoundPropertyModel<XXX>(new YYY());

        without generating a compiler error. Would it make sense to replace
        this constructor by two constructors...

        /**
        * Constructor
        *
        * @param object
        * The model object
        */
        public CompoundPropertyModel(final T object)
        { target = object; }

      /**

      • Constructor
        *
      • @param object
      • an instance of IModel<T>
        */
        public CompoundPropertyModel(final IModel<T> object) { target = object; }

      at least on 1.5?

      Attachments

        Activity

          People

            pete Peter Ertl
            reiern70 Ernesto Reinaldo Barreiro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified