Remove @Deprecated CompositeObjectRegistration 79/38879/2
authorMichael Vorburger <vorburger@redhat.com>
Fri, 13 May 2016 15:20:44 +0000 (17:20 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 6 Jun 2016 10:30:19 +0000 (10:30 +0000)
Not sure what ODL policy is re. clean up of deprecated classes, so I'm
proposing to killing one, and see what happens... ;-)
https://twitter.com/drdeprecator

If this must be kept, then I'll fix the catch (Exception e)
e.printStackTrace() in it, with LOGGER, because this is the only
critical issue yangtools has on Sonar.

Change-Id: Ice796b5cae5ce54df88e3227f9ec045e115c921b
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/CompositeObjectRegistration.java [deleted file]

diff --git a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/CompositeObjectRegistration.java b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/CompositeObjectRegistration.java
deleted file mode 100644 (file)
index f80f485..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.concepts;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @deprecated This class does not have good semantics with regard to constituent registrations' lifecycle and should
- *             not be used.
- */
-@Deprecated
-public final class CompositeObjectRegistration<T> extends AbstractObjectRegistration<T> {
-
-    private final Set<Registration> registrations;
-
-    public CompositeObjectRegistration(final T instance, final Collection<? extends Registration> registrations) {
-        super(instance);
-        if (registrations == null) {
-            throw new IllegalArgumentException();
-        }
-        this.registrations = Collections.unmodifiableSet(new HashSet<>(registrations));
-    }
-
-    @Override
-    protected void removeRegistration() {
-        for (Registration registration : registrations) {
-            try {
-                registration.close();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public static <T> CompositeObjectRegistrationBuilder<T> builderFor(final T instance) {
-        return new CompositeObjectRegistrationBuilder<>(instance);
-    }
-
-    public static final class CompositeObjectRegistrationBuilder<T> implements Builder<CompositeObjectRegistration<T>> {
-
-        private final T instance;
-        private final Set<Registration> registrations;
-
-        public CompositeObjectRegistrationBuilder(final T instance) {
-            this.instance = instance;
-            registrations = new HashSet<>();
-        }
-
-        public CompositeObjectRegistrationBuilder<T> add(final ObjectRegistration<? super T> registration) {
-            if (!registration.getInstance().equals(instance)) {
-                throw new IllegalArgumentException("Instance must be same.");
-            }
-            registrations.add(registration);
-            return this;
-        }
-
-        public CompositeObjectRegistrationBuilder<T> remove(final ObjectRegistration<? super T> registration) {
-            if (!registration.getInstance().equals(instance)) {
-                throw new IllegalArgumentException("Instance must be same.");
-            }
-            registrations.remove(registration);
-            return this;
-        }
-
-        @Override
-        public CompositeObjectRegistration<T> build() {
-            return new CompositeObjectRegistration<>(instance, registrations);
-        }
-    }
-}