You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2014/07/28 11:05:53 UTC

Re: [1/2] git commit: WICKET-5350 remove wildcards from #ofList() and others

I think it would be better to mark the Wildcard*** classes as deprecated
for Wicket 7.x and remove them in 8.x


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Sun, Jul 27, 2014 at 12:45 AM, <sv...@apache.org> wrote:

> Repository: wicket
> Updated Branches:
>   refs/heads/WICKET-5350-wildcards [created] a04fc96a7
>
>
> WICKET-5350 remove wildcards from #ofList() and others
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/06231408
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/06231408
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/06231408
>
> Branch: refs/heads/WICKET-5350-wildcards
> Commit: 06231408eedb028c1887b22e9265cc8591a8d4d0
> Parents: 90b7ca9
> Author: svenmeier <sv...@meiers.net>
> Authored: Sat Jul 26 23:41:37 2014 +0200
> Committer: svenmeier <sv...@meiers.net>
> Committed: Sat Jul 26 23:41:37 2014 +0200
>
> ----------------------------------------------------------------------
>  .../java/org/apache/wicket/model/Model.java     | 18 +++---
>  .../model/util/WildcardCollectionModel.java     | 57 ------------------
>  .../wicket/model/util/WildcardListModel.java    | 62 --------------------
>  .../wicket/model/util/WildcardSetModel.java     | 57 ------------------
>  4 files changed, 9 insertions(+), 185 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/06231408/wicket-core/src/main/java/org/apache/wicket/model/Model.java
> ----------------------------------------------------------------------
> diff --git a/wicket-core/src/main/java/org/apache/wicket/model/Model.java
> b/wicket-core/src/main/java/org/apache/wicket/model/Model.java
> index 8cdadac..4838d4b 100644
> --- a/wicket-core/src/main/java/org/apache/wicket/model/Model.java
> +++ b/wicket-core/src/main/java/org/apache/wicket/model/Model.java
> @@ -24,10 +24,10 @@ import java.util.Map;
>  import java.util.Set;
>
>  import org.apache.wicket.WicketRuntimeException;
> +import org.apache.wicket.model.util.CollectionModel;
> +import org.apache.wicket.model.util.ListModel;
>  import org.apache.wicket.model.util.MapModel;
> -import org.apache.wicket.model.util.WildcardCollectionModel;
> -import org.apache.wicket.model.util.WildcardListModel;
> -import org.apache.wicket.model.util.WildcardSetModel;
> +import org.apache.wicket.model.util.SetModel;
>  import org.apache.wicket.util.lang.Objects;
>
>
> @@ -78,9 +78,9 @@ public class Model<T extends Serializable> implements
> IModel<T>
>          *            The List, which may or may not be Serializable
>          * @return A Model object wrapping the List
>          */
> -       public static <C> IModel<List<? extends C>> ofList(final List<?
> extends C> list)
> +       public static <C> IModel<List<C>> ofList(final List<C> list)
>         {
> -               return new WildcardListModel<>(list);
> +               return new ListModel<>(list);
>         }
>
>         /**
> @@ -110,9 +110,9 @@ public class Model<T extends Serializable> implements
> IModel<T>
>          *            The Set, which may or may not be Serializable
>          * @return A Model object wrapping the Set
>          */
> -       public static <C> IModel<Set<? extends C>> ofSet(final Set<?
> extends C> set)
> +       public static <C> IModel<Set<C>> ofSet(final Set<C> set)
>         {
> -               return new WildcardSetModel<>(set);
> +               return new SetModel<>(set);
>         }
>
>         /**
> @@ -125,9 +125,9 @@ public class Model<T extends Serializable> implements
> IModel<T>
>          *            The Collection, which may or may not be Serializable
>          * @return A Model object wrapping the Set
>          */
> -       public static <C> IModel<Collection<? extends C>> of(final
> Collection<? extends C> collection)
> +       public static <C> IModel<Collection<C>> ofCollection(final
> Collection<C> collection)
>         {
> -               return new WildcardCollectionModel<>(collection);
> +               return new CollectionModel<>(collection);
>         }
>
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/06231408/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardCollectionModel.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardCollectionModel.java
> b/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardCollectionModel.java
> deleted file mode 100644
> index 8a8d138..0000000
> ---
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardCollectionModel.java
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You 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.apache.wicket.model.util;
> -
> -import java.util.ArrayList;
> -import java.util.Collection;
> -
> -
> -/**
> - * Based on <code>Model</code> but for any collections of serializable
> objects.
> - *
> - * @author Timo Rantalaiho
> - * @param <T>
> - *            type of object inside collection
> - */
> -public class WildcardCollectionModel<T> extends
> GenericBaseModel<Collection<? extends T>>
> -{
> -       private static final long serialVersionUID = 1L;
> -
> -       /**
> -        * Creates empty model
> -        */
> -       public WildcardCollectionModel()
> -       {
> -       }
> -
> -       /**
> -        * Creates model that will contain <code>collection</code>
> -        *
> -        * @param collection
> -        */
> -       public WildcardCollectionModel(Collection<? extends T> collection)
> -       {
> -               setObject(collection);
> -       }
> -
> -       /** {@inheritDoc} */
> -       @Override
> -       protected Collection<? extends T>
> createSerializableVersionOf(Collection<? extends T> object)
> -       {
> -               return new ArrayList<T>(object);
> -       }
> -}
> \ No newline at end of file
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/06231408/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardListModel.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardListModel.java
> b/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardListModel.java
> deleted file mode 100644
> index 059e7c7..0000000
> ---
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardListModel.java
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You 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.apache.wicket.model.util;
> -
> -import java.util.ArrayList;
> -import java.util.List;
> -
> -
> -/**
> - * Based on <code>Model</code> but for lists of serializable objects.
> - *
> - * @author Timo Rantalaiho
> - * @param <T>
> - *            type of object inside list
> - */
> -public class WildcardListModel<T> extends GenericBaseModel<List<? extends
> T>>
> -{
> -       private static final long serialVersionUID = 1L;
> -
> -       /**
> -        * Creates empty model
> -        */
> -       public WildcardListModel()
> -       {
> -       }
> -
> -       /**
> -        * Creates model that will contain <code>list</code>
> -        *
> -        * @param list
> -        *
> -        */
> -       public WildcardListModel(List<? extends T> list)
> -       {
> -               setObject(list);
> -       }
> -
> -       /** {@inheritDoc} */
> -       @Override
> -       protected List<? extends T> createSerializableVersionOf(List<?
> extends T> object)
> -       {
> -               if (object == null)
> -               {
> -                       return null;
> -               }
> -               return new ArrayList<T>(object);
> -       }
> -}
> \ No newline at end of file
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/06231408/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardSetModel.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardSetModel.java
> b/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardSetModel.java
> deleted file mode 100644
> index 97fabb7..0000000
> ---
> a/wicket-core/src/main/java/org/apache/wicket/model/util/WildcardSetModel.java
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You 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.apache.wicket.model.util;
> -
> -import java.util.HashSet;
> -import java.util.Set;
> -
> -
> -/**
> - * Based on <code>Model</code> but for sets of serializable objects.
> - *
> - * @author Timo Rantalaiho
> - * @param <T>
> - *            type of object inside set
> - */
> -public class WildcardSetModel<T> extends GenericBaseModel<Set<? extends
> T>>
> -{
> -       private static final long serialVersionUID = 1L;
> -
> -       /**
> -        * Creates empty model
> -        */
> -       public WildcardSetModel()
> -       {
> -       }
> -
> -       /**
> -        * Creates model that will contain <code>set</code>
> -        *
> -        * @param set
> -        */
> -       public WildcardSetModel(Set<? extends T> set)
> -       {
> -               setObject(set);
> -       }
> -
> -       /** {@inheritDoc} */
> -       @Override
> -       protected Set<? extends T> createSerializableVersionOf(Set<?
> extends T> object)
> -       {
> -               return new HashSet<T>(object);
> -       }
> -}
> \ No newline at end of file
>
>