Updated Branches: refs/heads/master 724066f40 -> 9df35c4e6
WICKET-5459 Use method chaining where it makes sense Use method chaining in XyzSettings classes Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9df35c4e Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9df35c4e Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9df35c4e Branch: refs/heads/master Commit: 9df35c4e65718a2261535a39105da691bca9da0e Parents: 724066f Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Mon Feb 3 10:32:48 2014 +0100 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Mon Feb 3 10:32:48 2014 +0100 ---------------------------------------------------------------------- .../wicket/settings/ApplicationSettings.java | 28 ++++++-- .../apache/wicket/settings/DebugSettings.java | 28 ++++++-- .../wicket/settings/ExceptionSettings.java | 12 +++- .../wicket/settings/FrameworkSettings.java | 14 ++-- .../settings/JavaScriptLibrarySettings.java | 16 +++-- .../apache/wicket/settings/MarkupSettings.java | 28 ++++++-- .../apache/wicket/settings/PageSettings.java | 16 +++-- .../wicket/settings/RequestCycleSettings.java | 32 ++++++--- .../wicket/settings/RequestLoggerSettings.java | 12 +++- .../wicket/settings/ResourceSettings.java | 73 +++++++++++++++----- .../wicket/settings/SecuritySettings.java | 32 ++++++--- .../apache/wicket/settings/StoreSettings.java | 20 ++++-- 12 files changed, 233 insertions(+), 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java index a69459e..eb8e2fb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java @@ -130,8 +130,9 @@ public class ApplicationSettings * * @param accessDeniedPage * The accessDeniedPage to set. + * @return {@code this} object for chaining */ - public void setAccessDeniedPage(Class<? extends Page> accessDeniedPage) + public ApplicationSettings setAccessDeniedPage(Class<? extends Page> accessDeniedPage) { if (accessDeniedPage == null) { @@ -140,6 +141,7 @@ public class ApplicationSettings checkPageClass(accessDeniedPage); this.accessDeniedPage = new WeakReference<Class<? extends Page>>(accessDeniedPage); + return this; } /** @@ -147,10 +149,12 @@ public class ApplicationSettings * * @param defaultClassResolver * The default class resolver + * @return {@code this} object for chaining */ - public void setClassResolver(final IClassResolver defaultClassResolver) + public ApplicationSettings setClassResolver(final IClassResolver defaultClassResolver) { classResolver = defaultClassResolver; + return this; } /** @@ -159,10 +163,12 @@ public class ApplicationSettings * * @param defaultMaximumUploadSize * the default maximum size for uploads + * @return {@code this} object for chaining */ - public void setDefaultMaximumUploadSize(Bytes defaultMaximumUploadSize) + public ApplicationSettings setDefaultMaximumUploadSize(Bytes defaultMaximumUploadSize) { this.defaultMaximumUploadSize = defaultMaximumUploadSize; + return this; } /** @@ -170,13 +176,15 @@ public class ApplicationSettings * * @param internalErrorPage * The internalErrorPage to set. + * @return {@code this} object for chaining */ - public void setInternalErrorPage(final Class<? extends Page> internalErrorPage) + public ApplicationSettings setInternalErrorPage(final Class<? extends Page> internalErrorPage) { Args.notNull(internalErrorPage, "internalErrorPage"); checkPageClass(internalErrorPage); this.internalErrorPage = new WeakReference<Class<? extends Page>>(internalErrorPage); + return this; } /** @@ -184,8 +192,9 @@ public class ApplicationSettings * * @param pageExpiredErrorPage * The pageExpiredErrorPage to set. + * @return {@code this} object for chaining */ - public void setPageExpiredErrorPage(final Class<? extends Page> pageExpiredErrorPage) + public ApplicationSettings setPageExpiredErrorPage(final Class<? extends Page> pageExpiredErrorPage) { if (pageExpiredErrorPage == null) { @@ -194,6 +203,7 @@ public class ApplicationSettings checkPageClass(pageExpiredErrorPage); this.pageExpiredErrorPage = new WeakReference<Class<? extends Page>>(pageExpiredErrorPage); + return this; } /** @@ -201,10 +211,12 @@ public class ApplicationSettings * * @param uploadProgressUpdatesEnabled * if true upload progress monitoring is enabled + * @return {@code this} object for chaining */ - public void setUploadProgressUpdatesEnabled(boolean uploadProgressUpdatesEnabled) + public ApplicationSettings setUploadProgressUpdatesEnabled(boolean uploadProgressUpdatesEnabled) { this.uploadProgressUpdatesEnabled = uploadProgressUpdatesEnabled; + return this; } /** @@ -233,11 +245,13 @@ public class ApplicationSettings * more details. * * @param filter + * @return {@code this} object for chaining */ - public void setFeedbackMessageCleanupFilter(IFeedbackMessageFilter filter) + public ApplicationSettings setFeedbackMessageCleanupFilter(IFeedbackMessageFilter filter) { Args.notNull(filter, "filter"); feedbackMessageCleanupFilter = filter; + return this; } /** http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java index f073b18..5be4213 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java @@ -118,20 +118,24 @@ public class DebugSettings * Enables or disables ajax debug mode. * * @param enable + * @return {@code this} object for chaining */ - public void setAjaxDebugModeEnabled(boolean enable) + public DebugSettings setAjaxDebugModeEnabled(boolean enable) { ajaxDebugModeEnabled = enable; + return this; } /** * Sets componentUseCheck debug settings * * @param componentUseCheck + * @return {@code this} object for chaining */ - public void setComponentUseCheck(final boolean componentUseCheck) + public DebugSettings setComponentUseCheck(final boolean componentUseCheck) { this.componentUseCheck = componentUseCheck; + return this; } /** @@ -141,10 +145,12 @@ public class DebugSettings * applications. * * @param enable + * @return {@code this} object for chaining */ - public void setLinePreciseReportingOnAddComponentEnabled(boolean enable) + public DebugSettings setLinePreciseReportingOnAddComponentEnabled(boolean enable) { linePreciseReportingOnAddComponentEnabled = enable; + return this; } /** @@ -153,10 +159,12 @@ public class DebugSettings * significant decrease in performance, do not use in customer facing applications. * * @param enable + * @return {@code this} object for chaining */ - public void setLinePreciseReportingOnNewComponentEnabled(boolean enable) + public DebugSettings setLinePreciseReportingOnNewComponentEnabled(boolean enable) { linePreciseReportingOnNewComponentEnabled = enable; + return this; } /** @@ -164,10 +172,12 @@ public class DebugSettings * class name. (Useful for determining which part of page belongs to which markup file). * * @param enable + * @return {@code this} object for chaining */ - public void setOutputMarkupContainerClassName(boolean enable) + public DebugSettings setOutputMarkupContainerClassName(boolean enable) { outputMarkupContainerClassName = enable; + return this; } /** @@ -185,20 +195,24 @@ public class DebugSettings * attribute of the component tag. This can be useful for debugging and automating tests. * * @param outputComponentPath + * @return {@code this} object for chaining */ - public void setOutputComponentPath(boolean outputComponentPath) + public DebugSettings setOutputComponentPath(boolean outputComponentPath) { this.outputComponentPath = outputComponentPath; + return this; } /** * Enables all of the panels and pages, etc, from wicket-devutils package. * * @param enable + * @return {@code this} object for chaining */ - public void setDevelopmentUtilitiesEnabled(boolean enable) + public DebugSettings setDevelopmentUtilitiesEnabled(boolean enable) { developmentUtilitiesEnabled = enable; + return this; } /** http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java index 7028150..7a10259 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java @@ -139,10 +139,12 @@ public class ExceptionSettings * * @param unexpectedExceptionDisplay * The unexpectedExceptionDisplay to set. + * @return {@code this} object for chaining */ - public void setUnexpectedExceptionDisplay(UnexpectedExceptionDisplay unexpectedExceptionDisplay) + public ExceptionSettings setUnexpectedExceptionDisplay(UnexpectedExceptionDisplay unexpectedExceptionDisplay) { this.unexpectedExceptionDisplay = unexpectedExceptionDisplay; + return this; } /** @@ -157,21 +159,25 @@ public class ExceptionSettings * Sets strategy used to handle errors during Ajax request processing * * @param errorHandlingStrategyDuringAjaxRequests + * @return {@code this} object for chaining */ - public void setAjaxErrorHandlingStrategy( + public ExceptionSettings setAjaxErrorHandlingStrategy( AjaxErrorStrategy errorHandlingStrategyDuringAjaxRequests) { this.errorHandlingStrategyDuringAjaxRequests = errorHandlingStrategyDuringAjaxRequests; + return this; } /** * Sets the strategy to use for dumping stack traces of live threads in the JVM. * * @param strategy + * @return {@code this} object for chaining */ - public void setThreadDumpStrategy(ThreadDumpStrategy strategy) + public ExceptionSettings setThreadDumpStrategy(ThreadDumpStrategy strategy) { threadDumpStrategy = Args.notNull(strategy, "strategy"); + return this; } /** http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java index c562bf9..32663da 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java @@ -101,28 +101,32 @@ public class FrameworkSettings implements IEventDispatcher * * @param detachListener * listener or <code>null</code> to remove + * @return {@code this} object for chaining */ - public void setDetachListener(IDetachListener detachListener) + public FrameworkSettings setDetachListener(IDetachListener detachListener) { this.detachListener = detachListener; + return this; } /** * Registers a new event dispatcher * * @param dispatcher + * @return {@code this} object for chaining */ - public void add(IEventDispatcher dispatcher) + public FrameworkSettings add(IEventDispatcher dispatcher) { Args.notNull(dispatcher, "dispatcher"); if (eventDispatchers == null) { - eventDispatchers = new ArrayList<IEventDispatcher>(); + eventDispatchers = new ArrayList<>(); } if (!eventDispatchers.contains(dispatcher)) { eventDispatchers.add(dispatcher); } + return this; } /** @@ -163,10 +167,12 @@ public class FrameworkSettings implements IEventDispatcher * * @param serializer * the {@link ISerializer} to use + * @return {@code this} object for chaining */ - public void setSerializer(ISerializer serializer) + public FrameworkSettings setSerializer(ISerializer serializer) { this.serializer = Args.notNull(serializer, "serializer"); + return this; } /** http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java index 35a2fb8..309ded2 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java @@ -58,10 +58,12 @@ public class JavaScriptLibrarySettings * @param jQueryReference * a reference to the JQuery JavaScript library used as backing library for * wicket-event and wicket-ajax + * @return {@code this} object for chaining */ - public void setJQueryReference(ResourceReference jQueryReference) + public JavaScriptLibrarySettings setJQueryReference(ResourceReference jQueryReference) { this.jQueryReference = Args.notNull(jQueryReference, "jQueryReference"); + return this; } /** @@ -75,10 +77,12 @@ public class JavaScriptLibrarySettings /** * @param wicketEventReference * a reference to the implementation of wicket-event.js + * @return {@code this} object for chaining */ - public void setWicketEventReference(ResourceReference wicketEventReference) + public JavaScriptLibrarySettings setWicketEventReference(ResourceReference wicketEventReference) { this.wicketEventReference = Args.notNull(wicketEventReference, "wicketEventReference"); + return this; } /** @@ -92,10 +96,12 @@ public class JavaScriptLibrarySettings /** * @param wicketAjaxReference * a reference to the implementation of wicket-ajax.js + * @return {@code this} object for chaining */ - public void setWicketAjaxReference(ResourceReference wicketAjaxReference) + public JavaScriptLibrarySettings setWicketAjaxReference(ResourceReference wicketAjaxReference) { this.wicketAjaxReference = Args.notNull(wicketAjaxReference, "wicketAjaxReference"); + return this; } /** @@ -111,11 +117,13 @@ public class JavaScriptLibrarySettings /** * @param wicketAjaxDebugReference * a reference to the implementation of wicket-ajax-debug.js + * @return {@code this} object for chaining */ - public void setWicketAjaxDebugReference(ResourceReference wicketAjaxDebugReference) + public JavaScriptLibrarySettings setWicketAjaxDebugReference(ResourceReference wicketAjaxDebugReference) { this.wicketAjaxDebugReference = Args.notNull(wicketAjaxDebugReference, "wicketAjaxDebugReference"); + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java index c79260b..f615340 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java @@ -148,10 +148,12 @@ public class MarkupSettings * The automaticLinking to set. * @see org.apache.wicket.markup.resolver.AutoLinkResolver * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler + * @return {@code this} object for chaining */ - public void setAutomaticLinking(boolean automaticLinking) + public MarkupSettings setAutomaticLinking(boolean automaticLinking) { this.automaticLinking = automaticLinking; + return this; } /** @@ -169,10 +171,12 @@ public class MarkupSettings * * @param compressWhitespace * The compressWhitespace to set. + * @return {@code this} object for chaining */ - public void setCompressWhitespace(final boolean compressWhitespace) + public MarkupSettings setCompressWhitespace(final boolean compressWhitespace) { this.compressWhitespace = compressWhitespace; + return this; } /** @@ -181,21 +185,25 @@ public class MarkupSettings * * @since 1.1 * @param encoding + * @return {@code this} object for chaining */ - public void setDefaultMarkupEncoding(final String encoding) + public MarkupSettings setDefaultMarkupEncoding(final String encoding) { defaultMarkupEncoding = encoding; + return this; } /** * Set a new markup factory * * @param factory + * @return {@code this} object for chaining */ - public void setMarkupFactory(final MarkupFactory factory) + public MarkupSettings setMarkupFactory(final MarkupFactory factory) { Args.notNull(factory, "markup factory"); markupFactory = factory; + return this; } /** @@ -203,10 +211,12 @@ public class MarkupSettings * * @param stripComments * True to strip markup comments from rendered pages + * @return {@code this} object for chaining */ - public void setStripComments(boolean stripComments) + public MarkupSettings setStripComments(boolean stripComments) { this.stripComments = stripComments; + return this; } /** @@ -214,10 +224,12 @@ public class MarkupSettings * * @param stripWicketTags * whether to remove wicket tags from the output + * @return {@code this} object for chaining */ - public void setStripWicketTags(boolean stripWicketTags) + public MarkupSettings setStripWicketTags(boolean stripWicketTags) { this.stripWicketTags = stripWicketTags; + return this; } /** @@ -225,9 +237,11 @@ public class MarkupSettings * * @since 1.3 * @param throwException + * @return {@code this} object for chaining */ - public void setThrowExceptionOnMissingXmlDeclaration(boolean throwException) + public MarkupSettings setThrowExceptionOnMissingXmlDeclaration(boolean throwException) { throwExceptionOnMissingXmlDeclaration = throwException; + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/PageSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/PageSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/PageSettings.java index aa8a351..e003074 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/PageSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/PageSettings.java @@ -55,10 +55,12 @@ public class PageSettings * * @param resolver * The {@link IComponentResolver} that is added + * @return {@code this} object for chaining */ - public void addComponentResolver(IComponentResolver resolver) + public PageSettings addComponentResolver(IComponentResolver resolver) { componentResolvers.add(resolver); + return this; } /** @@ -91,10 +93,12 @@ public class PageSettings * @param pagesVersionedByDefault * a flag that indicates whether pages should increase their page id when * their component hierarchy changes somehow. + * @return {@code this} object for chaining */ - public void setVersionPagesByDefault(boolean pagesVersionedByDefault) + public PageSettings setVersionPagesByDefault(boolean pagesVersionedByDefault) { versionPagesByDefault = pagesVersionedByDefault; + return this; } /** @@ -116,10 +120,12 @@ public class PageSettings * Sets the recreateMountedPagesAfterExpiry setting * * @param recreateMountedPagesAfterExpiry + * @return {@code this} object for chaining */ - public void setRecreateMountedPagesAfterExpiry(boolean recreateMountedPagesAfterExpiry) + public PageSettings setRecreateMountedPagesAfterExpiry(boolean recreateMountedPagesAfterExpiry) { this.recreateMountedPagesAfterExpiry = recreateMountedPagesAfterExpiry; + return this; } /** @@ -141,9 +147,11 @@ public class PageSettings * {@code true} if Wicket should execute the listener interface * @see #setRecreateMountedPagesAfterExpiry(boolean) * @see org.apache.wicket.request.component.IRequestableComponent#canCallListenerInterfaceAfterExpiry() + * @return {@code this} object for chaining */ - public void setCallListenerInterfaceAfterExpiry(boolean callListenerInterfaceAfterExpiry) + public PageSettings setCallListenerInterfaceAfterExpiry(boolean callListenerInterfaceAfterExpiry) { this.callListenerInterfaceAfterExpiry = callListenerInterfaceAfterExpiry; + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java index 512159e..484e58a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java @@ -29,7 +29,7 @@ import org.apache.wicket.util.time.Duration; * <p> * <i>bufferResponse </i> (defaults to true) - True if the application should buffer responses. This * does require some additional memory, but helps keep exception displays accurate because the whole - * rendering process completes before the page is sent to the user, thus avoiding the possibility of + * rendering process completes before the page is sent to the user, thus aRequestCycleSettingsing the possibility of * a partially rendered page. * <p> * <i>renderStrategy </i>- Sets in what way the render part of a request is handled. Basically, @@ -182,14 +182,16 @@ public class RequestCycleSettings * * @param responseFilter * The {@link IResponseFilter} that is added + * @return {@code this} object for chaining */ - public void addResponseFilter(IResponseFilter responseFilter) + public RequestCycleSettings addResponseFilter(IResponseFilter responseFilter) { if (responseFilters == null) { - responseFilters = new ArrayList<IResponseFilter>(3); + responseFilters = new ArrayList<>(3); } responseFilters.add(responseFilter); + return this; } /** @@ -287,10 +289,12 @@ public class RequestCycleSettings * * @param bufferResponse * {@code true} if the application should buffer response's headers. + * @return {@code this} object for chaining */ - public void setBufferResponse(boolean bufferResponse) + public RequestCycleSettings setBufferResponse(boolean bufferResponse) { this.bufferResponse = bufferResponse; + return this; } /** @@ -313,10 +317,12 @@ public class RequestCycleSettings * * @param gatherExtendedBrowserInfo * Whether to gather extensive client info + * @return {@code this} object for chaining */ - public void setGatherExtendedBrowserInfo(boolean gatherExtendedBrowserInfo) + public RequestCycleSettings setGatherExtendedBrowserInfo(boolean gatherExtendedBrowserInfo) { this.gatherExtendedBrowserInfo = gatherExtendedBrowserInfo; + return this; } /** @@ -351,10 +357,12 @@ public class RequestCycleSettings * * @param renderStrategy * the render strategy that should be used by default. + * @return {@code this} object for chaining */ - public void setRenderStrategy(RequestCycleSettings.RenderStrategy renderStrategy) + public RequestCycleSettings setRenderStrategy(RequestCycleSettings.RenderStrategy renderStrategy) { this.renderStrategy = renderStrategy; + return this; } /** @@ -366,11 +374,13 @@ public class RequestCycleSettings * * @param encoding * The request and response encoding to be used. + * @return {@code this} object for chaining */ - public void setResponseRequestEncoding(final String encoding) + public RequestCycleSettings setResponseRequestEncoding(final String encoding) { Args.notNull(encoding, "encoding"); this.responseRequestEncoding = encoding; + return this; } /** @@ -378,11 +388,13 @@ public class RequestCycleSettings * handled before giving up. * * @param timeout + * @return {@code this} object for chaining */ - public void setTimeout(Duration timeout) + public RequestCycleSettings setTimeout(Duration timeout) { Args.notNull(timeout, "timeout"); this.timeout = timeout; + return this; } /** @@ -390,10 +402,12 @@ public class RequestCycleSettings * giving up. * @param retries * the number of attempts + * @return {@code this} object for chaining */ - public void setExceptionRetryCount(int retries) + public RequestCycleSettings setExceptionRetryCount(int retries) { this.exceptionRetryCount = retries; + return this; } /** http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java index bca2d41..519bcb6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestLoggerSettings.java @@ -62,10 +62,12 @@ public class RequestLoggerSettings * Enable/Disable the recording of the session size for every request. * * @param record + * @return {@code this} object for chaining */ - public void setRecordSessionSize(boolean record) + public RequestLoggerSettings setRecordSessionSize(boolean record) { recordSessionSize = record; + return this; } /** @@ -73,10 +75,12 @@ public class RequestLoggerSettings * * @param enable * boolean. + * @return {@code this} object for chaining */ - public void setRequestLoggerEnabled(boolean enable) + public RequestLoggerSettings setRequestLoggerEnabled(boolean enable) { requestLoggerEnabled = enable; + return this; } /** @@ -85,9 +89,11 @@ public class RequestLoggerSettings * size) * * @param size + * @return {@code this} object for chaining */ - public void setRequestsWindowSize(int size) + public RequestLoggerSettings setRequestsWindowSize(int size) { requestsWindowSize = size; + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java index 1d7bf1c..3b6b440 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java @@ -232,10 +232,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * The name to give to the factory * @param resourceFactory * The resource factory to add + * @return {@code this} object for chaining */ - public void addResourceFactory(final String name, IResourceFactory resourceFactory) + public ResourceSettings addResourceFactory(final String name, IResourceFactory resourceFactory) { nameToResourceFactory.put(name, resourceFactory); + return this; } public Localizer getLocalizer() @@ -337,10 +339,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * Sets the resource watcher * * @param watcher + * @return {@code this} object for chaining */ - public void setResourceWatcher(IModificationWatcher watcher) + public ResourceSettings setResourceWatcher(IModificationWatcher watcher) { resourceWatcher = watcher; + return this; } /** @@ -358,10 +362,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param fileUploadCleaner * the actual cleaner implementation. Can be <code>null</code> + * @return {@code this} object for chaining */ - public void setFileCleaner(IFileCleaner fileUploadCleaner) + public ResourceSettings setFileCleaner(IFileCleaner fileUploadCleaner) { fileCleaner = fileUploadCleaner; + return this; } /** @@ -390,10 +396,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param localizer * @since 1.3.0 + * @return {@code this} object for chaining */ - public void setLocalizer(final Localizer localizer) + public ResourceSettings setLocalizer(final Localizer localizer) { this.localizer = localizer; + return this; } /** @@ -401,20 +409,24 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param packageResourceGuard * The package resource guard + * @return {@code this} object for chaining */ - public void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard) + public ResourceSettings setPackageResourceGuard(IPackageResourceGuard packageResourceGuard) { this.packageResourceGuard = Args.notNull(packageResourceGuard, "packageResourceGuard"); + return this; } /** * Set the property factory which will be used to load property files * * @param factory + * @return {@code this} object for chaining */ - public void setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory factory) + public ResourceSettings setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory factory) { propertiesFactory = factory; + return this; } /** @@ -425,14 +437,16 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param resourceFinders * The resourceFinders to set + * @return {@code this} object for chaining */ - public void setResourceFinders(final List<IResourceFinder> resourceFinders) + public ResourceSettings setResourceFinders(final List<IResourceFinder> resourceFinders) { Args.notNull(resourceFinders, "resourceFinders"); this.resourceFinders = resourceFinders; // Cause resource locator to get recreated resourceStreamLocator = null; + return this; } /** @@ -443,10 +457,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * @param resourcePollFrequency * Frequency at which to poll resources or <code>null</code> if polling should be * disabled + * @return {@code this} object for chaining */ - public void setResourcePollFrequency(final Duration resourcePollFrequency) + public ResourceSettings setResourcePollFrequency(final Duration resourcePollFrequency) { this.resourcePollFrequency = resourcePollFrequency; + return this; } /** @@ -460,24 +476,33 @@ public class ResourceSettings implements IPropertiesFactoryContext * new resource stream locator * * @see #getResourceStreamLocator() + * @return {@code this} object for chaining */ - public void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator) + public ResourceSettings setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator) { this.resourceStreamLocator = resourceStreamLocator; + return this; } - public void setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource) + /** + * @param throwExceptionOnMissingResource + * @return {@code this} object for chaining + */ + public ResourceSettings setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource) { this.throwExceptionOnMissingResource = throwExceptionOnMissingResource; + return this; } /** * @param useDefaultOnMissingResource * Whether to use a default value (if available) when a missing resource is requested + * @return {@code this} object for chaining */ - public void setUseDefaultOnMissingResource(final boolean useDefaultOnMissingResource) + public ResourceSettings setUseDefaultOnMissingResource(final boolean useDefaultOnMissingResource) { this.useDefaultOnMissingResource = useDefaultOnMissingResource; + return this; } /** @@ -504,11 +529,13 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @see org.apache.wicket.util.time.Duration#NONE * @see org.apache.wicket.request.http.WebResponse#MAX_CACHE_DURATION + * @return {@code this} object for chaining */ - public final void setDefaultCacheDuration(Duration duration) + public final ResourceSettings setDefaultCacheDuration(Duration duration) { Args.notNull(duration, "duration"); defaultCacheDuration = duration; + return this; } /** @@ -532,6 +559,7 @@ public class ResourceSettings implements IPropertiesFactoryContext * @param compressor * The implementation to be used * @return The old value + * @return {@code this} object for chaining */ public IJavaScriptCompressor setJavaScriptCompressor(IJavaScriptCompressor compressor) { @@ -561,6 +589,7 @@ public class ResourceSettings implements IPropertiesFactoryContext * @param compressor * The implementation to be used * @return The old value + * @return {@code this} object for chaining */ public ICssCompressor setCssCompressor(ICssCompressor compressor) { @@ -598,10 +627,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param sequence * character sequence which must not be ambiguous within urls + * @return {@code this} object for chaining */ - public void setParentFolderPlaceholder(final String sequence) + public ResourceSettings setParentFolderPlaceholder(final String sequence) { parentFolderPlaceholder = sequence; + return this; } /** @@ -644,8 +675,9 @@ public class ResourceSettings implements IPropertiesFactoryContext * instance of resource caching strategy * * @see IResourceCachingStrategy + * @return {@code this} object for chaining */ - public void setCachingStrategy(IResourceCachingStrategy strategy) + public ResourceSettings setCachingStrategy(IResourceCachingStrategy strategy) { if (strategy == null) { @@ -654,6 +686,7 @@ public class ResourceSettings implements IPropertiesFactoryContext "Please use " + NoOpResourceCachingStrategy.class.getName() + " instead."); } resourceCachingStrategy = strategy; + return this; } /** @@ -665,10 +698,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param useMinifiedResources * The new value for the setting + * @return {@code this} object for chaining */ - public void setUseMinifiedResources(boolean useMinifiedResources) + public ResourceSettings setUseMinifiedResources(boolean useMinifiedResources) { this.useMinifiedResources = useMinifiedResources; + return this; } /** @@ -696,10 +731,12 @@ public class ResourceSettings implements IPropertiesFactoryContext * @param headerItemComparator * The comparator used to sort header items, when null, header items will not be * sorted. + * @return {@code this} object for chaining */ - public void setHeaderItemComparator(Comparator<? super RecordedHeaderItem> headerItemComparator) + public ResourceSettings setHeaderItemComparator(Comparator<? super RecordedHeaderItem> headerItemComparator) { this.headerItemComparator = headerItemComparator; + return this; } /** @@ -723,9 +760,11 @@ public class ResourceSettings implements IPropertiesFactoryContext * * @param encodeJSessionId * {@code true} when the jsessionid should be encoded, {@code false} - otherwise + * @return {@code this} object for chaining */ - public void setEncodeJSessionId(boolean encodeJSessionId) + public ResourceSettings setEncodeJSessionId(boolean encodeJSessionId) { this.encodeJSessionId = encodeJSessionId; + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java index 35abba6..bdc6836 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java @@ -146,11 +146,13 @@ public class SecuritySettings * * @param strategy * new authorization strategy + * @return {@code this} object for chaining */ - public void setAuthorizationStrategy(IAuthorizationStrategy strategy) + public SecuritySettings setAuthorizationStrategy(IAuthorizationStrategy strategy) { Args.notNull(strategy, "strategy"); authorizationStrategy = strategy; + return this; } /** @@ -158,11 +160,13 @@ public class SecuritySettings * the first call is cached. * * @param cryptFactory + * @return {@code this} object for chaining */ - public void setCryptFactory(ICryptFactory cryptFactory) + public SecuritySettings setCryptFactory(ICryptFactory cryptFactory) { Args.notNull(cryptFactory, "cryptFactory"); this.cryptFactory = cryptFactory; + return this; } /** @@ -172,21 +176,27 @@ public class SecuritySettings * * @param enforce * Whether mounts should be enforced + * @return {@code this} object for chaining */ - public void setEnforceMounts(boolean enforce) + public SecuritySettings setEnforceMounts(boolean enforce) { enforceMounts = enforce; + return this; } /** * @param listener * The listener to set * @see IUnauthorizedComponentInstantiationListener + * @return {@code this} object for chaining */ - public void setUnauthorizedComponentInstantiationListener( + public SecuritySettings setUnauthorizedComponentInstantiationListener( IUnauthorizedComponentInstantiationListener listener) { - this.unauthorizedComponentInstantiationListener = listener == null ? DEFAULT_UNAUTHORIZED_COMPONENT_INSTANTIATION_LISTENER : listener; + this.unauthorizedComponentInstantiationListener = listener == null ? + DEFAULT_UNAUTHORIZED_COMPONENT_INSTANTIATION_LISTENER : + listener; + return this; } /** @@ -202,10 +212,14 @@ public class SecuritySettings * * @param listener * The listener + * @return {@code this} object for chaining */ - public void setUnauthorizedResourceRequestListener(IUnauthorizedResourceRequestListener listener) + public SecuritySettings setUnauthorizedResourceRequestListener(IUnauthorizedResourceRequestListener listener) { - this.unauthorizedResourceRequestListener = listener == null ? DEFAULT_UNAUTHORIZED_RESOURCE_REQUEST_LISTENER : listener; + this.unauthorizedResourceRequestListener = listener == null ? + DEFAULT_UNAUTHORIZED_RESOURCE_REQUEST_LISTENER : + listener; + return this; } /** @@ -227,9 +241,11 @@ public class SecuritySettings * * @param strategy * new authentication strategy + * @return {@code this} object for chaining */ - public void setAuthenticationStrategy(final IAuthenticationStrategy strategy) + public SecuritySettings setAuthenticationStrategy(final IAuthenticationStrategy strategy) { authenticationStrategy = strategy; + return this; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/9df35c4e/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java index bcf142e..0abc379 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java @@ -79,10 +79,12 @@ public class StoreSettings * @param inmemoryCacheSize * the maximum number of page instances which will be held in the application scoped * cache + * @return {@code this} object for chaining */ - public void setInmemoryCacheSize(int inmemoryCacheSize) + public StoreSettings setInmemoryCacheSize(int inmemoryCacheSize) { this.inmemoryCacheSize = inmemoryCacheSize; + return this; } /** @@ -103,10 +105,12 @@ public class StoreSettings * @param maxSizePerSession * the maximum size of the file where page instances are stored per session. In * bytes. + * @return {@code this} object for chaining */ - public void setMaxSizePerSession(final Bytes maxSizePerSession) + public StoreSettings setMaxSizePerSession(final Bytes maxSizePerSession) { this.maxSizePerSession = Args.notNull(maxSizePerSession, "maxSizePerSession"); + return this; } /** @@ -146,10 +150,12 @@ public class StoreSettings * * @param fileStoreFolder * the new location + * @return {@code this} object for chaining */ - public void setFileStoreFolder(final File fileStoreFolder) + public StoreSettings setFileStoreFolder(final File fileStoreFolder) { this.fileStoreFolder = Args.notNull(fileStoreFolder, "fileStoreFolder"); + return this; } /** @@ -167,8 +173,9 @@ public class StoreSettings * @param queueCapacity * the capacity of the queue * @see org.apache.wicket.pageStore.AsynchronousDataStore + * @return {@code this} object for chaining */ - public void setAsynchronousQueueCapacity(int queueCapacity) + public StoreSettings setAsynchronousQueueCapacity(int queueCapacity) { if (queueCapacity < 1) { @@ -176,6 +183,7 @@ public class StoreSettings "The capacity of the asynchronous queue should be at least 1."); } asynchronousQueueCapacity = queueCapacity; + return this; } /** @@ -185,10 +193,12 @@ public class StoreSettings * * @param async * {@code true} to make it asynchronous, {@code false} - otherwise + * @return {@code this} object for chaining */ - public void setAsynchronous(boolean async) + public StoreSettings setAsynchronous(boolean async) { isAsynchronous = async; + return this; } /**
