001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket; 018 019import org.apache.wicket.request.component.IRequestablePage; 020import org.apache.wicket.request.mapper.parameter.PageParameters; 021 022 023/** 024 * A factory class that creates Pages. A Page can be created by Class, with or without a 025 * PageParameters argument to pass to the Page's constructor. 026 * <p> 027 * IMPORTANT NOTE: Implementations must let subclasses of 028 * {@link org.apache.wicket.request.flow.ResetResponseException} thrown from the constructing page's 029 * constructor bubble up. 030 * 031 * @see org.apache.wicket.Application#newPageFactory() 032 * @see Session#getPageFactory() 033 * 034 * @author Juergen Donnerstag 035 * @author Jonathan Locke 036 */ 037public interface IPageFactory 038{ 039 /** 040 * Creates a new page using a page class. 041 * 042 * @param <C> 043 * the type of the page class 044 * @param pageClass 045 * The page class to instantiate 046 * @return The page 047 * @throws WicketRuntimeException 048 * Thrown if the page cannot be constructed 049 */ 050 <C extends IRequestablePage> C newPage(final Class<C> pageClass); 051 052 /** 053 * Creates a new Page, passing PageParameters to the Page constructor if such a constructor 054 * exists. If no such constructor exists and the parameters argument is null or empty, then any 055 * available default constructor will be used. 056 * 057 * @param <C> 058 * the type of the page class 059 * @param pageClass 060 * The class of Page to create 061 * @param parameters 062 * Any parameters to pass to the Page's constructor 063 * @return The new page 064 * @throws WicketRuntimeException 065 * Thrown if the page cannot be constructed 066 */ 067 <C extends IRequestablePage> C newPage(final Class<C> pageClass, final PageParameters parameters); 068 069 /** 070 * Checks whether a page can be instantiated using a bookmarkable URL. 071 * 072 * @param <C> 073 * the type of the page class 074 * @param pageClass 075 * The class of page to check for bookmarkability 076 * 077 * @return {@code true} if the page can be instantiated by this {@link IPageFactory} 078 */ 079 <C extends IRequestablePage> boolean isBookmarkable(final Class<C> pageClass); 080}