From 667785f41e30b83834a10141f6aff55ae5d3eb9d Mon Sep 17 00:00:00 2001 From: Ben Fortuna Date: Thu, 6 Jan 2022 20:00:55 +1100 Subject: [PATCH] Refactoring around deprecation changes --- .../net/fortuna/ical4j/model/Calendar.java | 19 +++------------ .../net/fortuna/ical4j/model/Component.java | 11 ++------- .../net/fortuna/ical4j/model/Property.java | 23 +++++++------------ .../ical4j/model/PropertyContainer.java | 10 ++++---- .../ical4j/model/component/Participant.java | 8 +------ .../ical4j/model/component/VAvailability.java | 8 +------ .../ical4j/model/component/VEvent.java | 8 +------ .../ical4j/model/component/VFreeBusy.java | 8 +------ .../ical4j/model/component/VJournal.java | 8 +------ .../ical4j/model/component/VTimeZone.java | 8 +------ .../fortuna/ical4j/model/component/VToDo.java | 8 +------ 11 files changed, 25 insertions(+), 94 deletions(-) diff --git a/src/main/java/net/fortuna/ical4j/model/Calendar.java b/src/main/java/net/fortuna/ical4j/model/Calendar.java index 1102d5ea3..ad288f7c3 100644 --- a/src/main/java/net/fortuna/ical4j/model/Calendar.java +++ b/src/main/java/net/fortuna/ical4j/model/Calendar.java @@ -202,14 +202,8 @@ public List getComponents() { } /** - * @return Returns the components. - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public final ComponentList getComponentList() { return components; @@ -225,22 +219,15 @@ public List getProperties() { } /** - * @return Returns the properties. - * @deprecated to avoid confusion with how to mutate a PropertyList from v4.x onwards this method is temporarily - * deprecated. - * @see PropertyContainer#add(Property) - * @see PropertyContainer#remove(Property) - * @see PropertyContainer#removeAll(String...) - * @see PropertyContainer#replace(Property) + * @return Returns the underlying property list. */ - @Deprecated @Override public final PropertyList getPropertyList() { return properties; } @Override - public void setProperties(PropertyList properties) { + public void setPropertyList(PropertyList properties) { this.properties = properties; } diff --git a/src/main/java/net/fortuna/ical4j/model/Component.java b/src/main/java/net/fortuna/ical4j/model/Component.java index 512918e6b..4919ceba6 100644 --- a/src/main/java/net/fortuna/ical4j/model/Component.java +++ b/src/main/java/net/fortuna/ical4j/model/Component.java @@ -190,22 +190,15 @@ public List getProperties() { } /** - * @return Returns the properties. - * @deprecated to avoid confusion with how to mutate a PropertyList from v4.x onwards this method is temporarily - * deprecated. - * @see PropertyContainer#add(Property) - * @see PropertyContainer#remove(Property) - * @see PropertyContainer#removeAll(String...) - * @see PropertyContainer#replace(Property) + * @return Returns the underlying property list. */ - @Deprecated @Override public final PropertyList getPropertyList() { return properties; } @Override - public void setProperties(PropertyList properties) { + public void setPropertyList(PropertyList properties) { this.properties = properties; } diff --git a/src/main/java/net/fortuna/ical4j/model/Property.java b/src/main/java/net/fortuna/ical4j/model/Property.java index b542116e3..129011f65 100644 --- a/src/main/java/net/fortuna/ical4j/model/Property.java +++ b/src/main/java/net/fortuna/ical4j/model/Property.java @@ -467,15 +467,8 @@ public final String getName() { } /** - * @return Returns the parameters. - * @deprecated to avoid confusion with how to mutate a {@link ParameterList} from v4.x onwards this method is temporarily - * deprecated. - * @see Property#add(Parameter) - * @see Property#remove(Parameter) - * @see Property#removeAll(String...) - * @see Property#replace(Parameter) - */ - @Deprecated + * @return Returns the underlying parameter list. + */ public final ParameterList getParameterList() { return parameters; } @@ -535,7 +528,7 @@ public T replace(Parameter parameter) { * @return a parameter list containing only parameters with the specified name */ public final List getParameters(final String... name) { - return getParameterList().get(name); + return parameters.get(name); } /** @@ -545,7 +538,7 @@ public final List getParameters(final String... name) { * @return the first parameter from the parameter list with the specified name */ public final

Optional

getParameter(final String name) { - return getParameterList().getFirst(name); + return parameters.getFirst(name); } /** @@ -555,7 +548,7 @@ public final

Optional

getParameter(final String name) { * @return */ public final

P getRequiredParameter(final String name) { - return getParameterList().getRequired(name); + return parameters.getRequired(name); } /** @@ -582,8 +575,8 @@ public final boolean equals(final Object arg0) { if (arg0 instanceof Property) { final Property p = (Property) arg0; return getName().equals(p.getName()) - && new EqualsBuilder().append(getValue(), p.getValue()).append(getParameterList(), - p.getParameterList()).isEquals(); + && new EqualsBuilder().append(getValue(), p.getValue()).append(parameters, + p.parameters).isEquals(); } return super.equals(arg0); } @@ -595,7 +588,7 @@ && new EqualsBuilder().append(getValue(), p.getValue()).append(getParameterList( public int hashCode() { // as property name is case-insensitive generate hash for uppercase.. return new HashCodeBuilder().append(getName().toUpperCase()).append( - getValue()).append(getParameterList()).toHashCode(); + getValue()).append(parameters).toHashCode(); } /** diff --git a/src/main/java/net/fortuna/ical4j/model/PropertyContainer.java b/src/main/java/net/fortuna/ical4j/model/PropertyContainer.java index 0aa559af3..59113660d 100644 --- a/src/main/java/net/fortuna/ical4j/model/PropertyContainer.java +++ b/src/main/java/net/fortuna/ical4j/model/PropertyContainer.java @@ -7,7 +7,7 @@ public interface PropertyContainer { PropertyList getPropertyList(); - void setProperties(PropertyList properties); + void setPropertyList(PropertyList properties); default List getProperties(final String... name) { return getPropertyList().get(name); @@ -34,7 +34,7 @@ default T getRequiredProperty(String name) throws Constrain * @return a reference to the container to support method chaining */ default PropertyContainer add(Property property) { - setProperties((PropertyList) getPropertyList().add(property)); + setPropertyList((PropertyList) getPropertyList().add(property)); return this; } @@ -44,7 +44,7 @@ default PropertyContainer add(Property property) { * @return a reference to the container to support method chaining */ default PropertyContainer remove(Property property) { - setProperties((PropertyList) getPropertyList().remove(property)); + setPropertyList((PropertyList) getPropertyList().remove(property)); return this; } @@ -54,7 +54,7 @@ default PropertyContainer remove(Property property) { * @return a reference to the container to support method chaining */ default PropertyContainer removeAll(String... name) { - setProperties((PropertyList) getPropertyList().removeAll(name)); + setPropertyList((PropertyList) getPropertyList().removeAll(name)); return this; } @@ -64,7 +64,7 @@ default PropertyContainer removeAll(String... name) { * @return a reference to the container to support method chaining */ default PropertyContainer replace(Property property) { - setProperties((PropertyList) getPropertyList().replace(property)); + setPropertyList((PropertyList) getPropertyList().replace(property)); return this; } } diff --git a/src/main/java/net/fortuna/ical4j/model/component/Participant.java b/src/main/java/net/fortuna/ical4j/model/component/Participant.java index 6a5b9098b..046a8bf30 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/Participant.java +++ b/src/main/java/net/fortuna/ical4j/model/component/Participant.java @@ -166,14 +166,8 @@ public final void validate(final boolean recurse) throws ValidationException { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VAvailability.java b/src/main/java/net/fortuna/ical4j/model/component/VAvailability.java index 9d1ee17a9..d547d9c99 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VAvailability.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VAvailability.java @@ -152,14 +152,8 @@ public final List getAvailable() { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VEvent.java b/src/main/java/net/fortuna/ical4j/model/component/VEvent.java index 9a3fedd3d..02bf6c28a 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VEvent.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VEvent.java @@ -328,14 +328,8 @@ public final List getAlarms() { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VFreeBusy.java b/src/main/java/net/fortuna/ical4j/model/component/VFreeBusy.java index 2b0681ef9..da3eb6ecc 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VFreeBusy.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VFreeBusy.java @@ -516,14 +516,8 @@ public void validate(Method method) throws ValidationException { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VJournal.java b/src/main/java/net/fortuna/ical4j/model/component/VJournal.java index e4816b3ee..2cca89c3d 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VJournal.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VJournal.java @@ -193,14 +193,8 @@ public void validate(Method method) throws ValidationException { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VTimeZone.java b/src/main/java/net/fortuna/ical4j/model/component/VTimeZone.java index 89b124c64..6a3cbcc16 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VTimeZone.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VTimeZone.java @@ -195,14 +195,8 @@ public final List getObservances() { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components; diff --git a/src/main/java/net/fortuna/ical4j/model/component/VToDo.java b/src/main/java/net/fortuna/ical4j/model/component/VToDo.java index d6570b9c0..4520fe805 100644 --- a/src/main/java/net/fortuna/ical4j/model/component/VToDo.java +++ b/src/main/java/net/fortuna/ical4j/model/component/VToDo.java @@ -249,14 +249,8 @@ public final ComponentList getAlarms() { /** * - * @return - * @deprecated to avoid confusion with how to mutate a ComponentList from v4.x onwards this method is temporarily - * deprecated. - * @see ComponentContainer#add(Component) - * @see ComponentContainer#remove(Component) - * @see ComponentContainer#replace(Component) + * @return Returns the underlying component list. */ - @Deprecated @Override public ComponentList getComponentList() { return (ComponentList) components;