Constructors PageParameters( String ... ) and PageParameters( String[], 
Object[] ), 
------------------------------------------------------------------------------------

                 Key: WICKET-3657
                 URL: https://issues.apache.org/jira/browse/WICKET-3657
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-core
    Affects Versions: 1.4.17
            Reporter: Ondra Žižka


I suggest to add two constructors to PageParameters class:
PageParameters( String ... ) and PageParameters( String[], Object[] ), 
Both would be useful for easier creating of BookmarkablePageLinks.

new BookmarkablePageLink<Resource>( "link", ResourcePage.class, 
              new PageParameters( ResourcePage.PARAM_NAME, 
this.getDefaultModelObjectAsString() ) );

new BookmarkablePageLink<Resource>( "link", ResourcePage.class, 
              new PageParameters( new String[]{ ResourcePage.PARAM_NAME }, new 
String[]{ this.getDefaultModelObjectAsString() } );


   public PageParameters( String ... args ) {
      
      if( args.length % 2 != 0 )
         throw new IllegalArgumentException("Arguments must make pairs - i.e. 
even number.");
      
      for ( int i = 0; i < args.length; i += 2 ) {
         this.put( args[i], args[i+1] );
      }
      
   }
   
   
   public PageParameters( String[] keys, Object[] values ) {
      
      if( keys.length != values.length )
         throw new IllegalArgumentException("Number of keys and values must 
equal.");
      
      for ( int i = 0; i < keys.length; i+ ) {
         this.put( keys[i], values[i] );
      }
      
   }
   


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to