Arthur Bogaart pushed to branch master at cms-community / hippo-cms
Commits: ac701e5e by Arthur Bogaart at 2016-11-10T21:47:31+01:00 CMS-10535 Use SerializableSupplier interface in ReadOnlyModel - - - - - 8a3d94f5 by Arthur Bogaart at 2016-11-15T13:28:04+01:00 CMS-10535 Annotate SerializableSupplier with @FunctionalInterface - - - - - 404079f5 by Arthur Bogaart at 2016-11-15T13:28:37+01:00 CMS-10535 ReadOnlyModel can be final - - - - - 2997ba1d by Arthur Bogaart at 2016-11-15T13:29:09+01:00 CMS-10535 Reintegrate bugfix/CMS-10535 - - - - - 2 changed files: - api/src/main/java/org/hippoecm/frontend/model/ReadOnlyModel.java - + api/src/main/java/org/hippoecm/frontend/model/SerializableSupplier.java Changes: ===================================== api/src/main/java/org/hippoecm/frontend/model/ReadOnlyModel.java ===================================== --- a/api/src/main/java/org/hippoecm/frontend/model/ReadOnlyModel.java +++ b/api/src/main/java/org/hippoecm/frontend/model/ReadOnlyModel.java @@ -15,18 +15,16 @@ */ package org.hippoecm.frontend.model; -import java.util.function.Supplier; - import org.apache.wicket.model.AbstractReadOnlyModel; /** * Read-only Wicket model that accepts a lambda function to return the object. */ -public class ReadOnlyModel<T> extends AbstractReadOnlyModel<T> { +public final class ReadOnlyModel<T> extends AbstractReadOnlyModel<T> { - private final Supplier<T> supplier; + private final SerializableSupplier<T> supplier; - private ReadOnlyModel(final Supplier<T> supplier) { + private ReadOnlyModel(final SerializableSupplier<T> supplier) { this.supplier = supplier; } @@ -35,7 +33,7 @@ public class ReadOnlyModel<T> extends AbstractReadOnlyModel<T> { return supplier.get(); } - public static <T> ReadOnlyModel<T> of(final Supplier<T> supplier) { + public static <T> ReadOnlyModel<T> of(final SerializableSupplier<T> supplier) { return new ReadOnlyModel<>(supplier); } } ===================================== api/src/main/java/org/hippoecm/frontend/model/SerializableSupplier.java ===================================== --- /dev/null +++ b/api/src/main/java/org/hippoecm/frontend/model/SerializableSupplier.java @@ -0,0 +1,23 @@ +/* + * Copyright 2016 Hippo B.V. (http://www.onehippo.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.hippoecm.frontend.model; + +import java.io.Serializable; +import java.util.function.Supplier; + +@FunctionalInterface +public interface SerializableSupplier<T> extends Supplier<T>, Serializable { +} View it on GitLab: https://code.onehippo.org/cms-community/hippo-cms/compare/d78426495715d6249f84ac1ace0deb54b855201e...2997ba1dd59cd83f49171116b4840e98e07d1201
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn