/*
* Copyright (c) 2015 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
+ * 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.controller.md.sal.binding.impl;
import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
abstract class ContextReferenceExtractor {
-
private static final Logger LOG = LoggerFactory.getLogger(ContextReferenceExtractor.class);
private static final ContextReferenceExtractor NULL_EXTRACTOR = new ContextReferenceExtractor() {
}
};
-
private static final LoadingCache<Class<?>, ContextReferenceExtractor> EXTRACTORS = CacheBuilder.newBuilder()
.weakKeys().build(new CacheLoader<Class<?>, ContextReferenceExtractor>() {
@Override
- public ContextReferenceExtractor load(final Class<?> key) throws Exception {
+ public ContextReferenceExtractor load(final Class<?> key) {
return create(key);
}
});
* Extract context-reference (Instance Identifier) from
* Binding DataObject.
*
- * @param obj DataObject from which context reference
- * should be extracted.
+ * @param obj DataObject from which context reference should be extracted.
*
- * @return Instance Identifier representing context reference
- * or null, if data object does not contain context reference.
+ * @return Instance Identifier representing context reference or null, if data object does not contain
+ * context reference.
*/
abstract @Nullable InstanceIdentifier<?> extract(DataObject obj);
- private static @Nonnull ContextReferenceExtractor create(final Class<?> key) {
+ @Nonnull
+ private static ContextReferenceExtractor create(final Class<?> key) {
final Method contextGetter = getContextGetter(key);
if (contextGetter == null) {
return NULL_EXTRACTOR;
return NULL_EXTRACTOR;
}
- private static @Nullable Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
+ @Nullable
+ private static Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
try {
final Method method = type.getMethod(GET_VALUE_NAME);
- if(returnType.equals(method.getReturnType())) {
+ if (returnType.equals(method.getReturnType())) {
return method;
}
} catch (final NoSuchMethodException e) {
}
return null;
}
-
-
-
}