Remove AbstractStringIdentityrefCodec and its subclasses 35/108035/4
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 5 Oct 2023 13:03:43 +0000 (15:03 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 5 Oct 2023 13:48:14 +0000 (13:48 +0000)
These classes are not used anywhere, remove them.

Change-Id: I56f257874c422ac33e0f37608e694c90fb7f4729
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractModuleStringIdentityrefCodec.java [deleted file]
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractStringIdentityrefCodec.java [deleted file]
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/ModuleStringIdentityrefCodec.java [deleted file]

diff --git a/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractModuleStringIdentityrefCodec.java b/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractModuleStringIdentityrefCodec.java
deleted file mode 100644 (file)
index d2de311..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014 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.yang.data.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-
-@Beta
-public abstract class AbstractModuleStringIdentityrefCodec extends AbstractStringIdentityrefCodec {
-    /**
-     * Resolve a string prefix into the corresponding module.
-     *
-     * @param prefix Prefix
-     * @return module mapped to prefix, or null if the module cannot be resolved
-     */
-    protected abstract @Nullable Module moduleForPrefix(@NonNull String prefix);
-
-    @Override
-    protected final QName createQName(final String prefix, final String localName) {
-        final Module module = moduleForPrefix(prefix);
-        checkArgument(module != null, "Failed to lookup prefix %s", prefix);
-
-        final QName qname = QName.create(module.getQNameModule(), localName);
-        for (IdentitySchemaNode identity : module.getIdentities()) {
-            if (qname.equals(identity.getQName())) {
-                return identity.getQName();
-            }
-        }
-
-        throw new IllegalArgumentException("Failed to find identity matching " + qname);
-    }
-}
diff --git a/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractStringIdentityrefCodec.java b/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractStringIdentityrefCodec.java
deleted file mode 100644 (file)
index 0f8a852..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2014 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.yang.data.util;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.codec.IdentityrefCodec;
-
-/**
- * Abstract utility class for representations which encode Identityref as a
- * prefix:name tuple. Typical uses are RESTCONF/JSON (module:name) and XML (prefix:name).
- */
-@Beta
-public abstract class AbstractStringIdentityrefCodec extends AbstractNamespaceCodec<QName>
-        implements IdentityrefCodec<String> {
-    @Override
-    protected final String serializeImpl(final QName data) {
-        return appendQName(new StringBuilder(), data).toString();
-    }
-
-    @Override
-    protected final QName deserializeImpl(final String data) {
-        return parseQName(data);
-    }
-}
diff --git a/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/ModuleStringIdentityrefCodec.java b/data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/ModuleStringIdentityrefCodec.java
deleted file mode 100644 (file)
index d331ff4..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2016 Intel Corporation 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.yang.data.util;
-
-import static java.util.Objects.requireNonNull;
-
-import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
-
-/**
- * Base class for implementing identityref codecs on based on module names.
- */
-@Beta
-public abstract class ModuleStringIdentityrefCodec extends AbstractModuleStringIdentityrefCodec
-        implements EffectiveModelContextProvider {
-    private final @NonNull EffectiveModelContext context;
-    private final @NonNull QNameModule parentModule;
-
-    protected ModuleStringIdentityrefCodec(final @NonNull EffectiveModelContext context,
-            final @NonNull QNameModule parentModule) {
-        this.context = requireNonNull(context);
-        this.parentModule = requireNonNull(parentModule);
-    }
-
-    @Override
-    public final EffectiveModelContext getEffectiveModelContext() {
-        return context;
-    }
-
-    protected final QNameModule getParentModule() {
-        return parentModule;
-    }
-
-    @Override
-    protected String prefixForNamespace(final XMLNamespace namespace) {
-        final var modules = context.findModuleStatements(namespace).iterator();
-        return modules.hasNext() ? modules.next().argument().getLocalName() : null;
-    }
-}