import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
-
import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Sets;
-
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
+import org.opendaylight.yangtools.util.ClassLoaderUtils;
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
* This method uses first generic argument of
* implemented {@link ChildOf} interface.
*
- * @param augmentation
- * {@link Augmentation} subclass for which we want to determine
- * augmentation target.
- * @return Augmentation target - class which augmentation provides
- * additional extensions.
+ * @param childClass
+ * child class for which we want to find the parent class.
+ * @return Parent class, e.g. class of which the childClass is ChildOf.
*/
public static Class<?> findHierarchicalParent(final Class<? extends ChildOf<?>> childClass) {
return ClassLoaderUtils.findFirstGenericArgument(childClass, ChildOf.class);
* This method is shorthand which gets DataObject class by invoking
* {@link DataObject#getImplementedInterface()} and uses {@link #findHierarchicalParent(Class)}.
*
- * @param childClass
- * {@link Augmentation} subclass for which we want to determine
- * augmentation target.
- * @return Augmentation target - class which augmentation provides
- * additional extensions.
+ * @param child
+ * Child object for which the parent needs to be located.
+ * @return Parent class, or null if a parent is not found.
*/
public static Class<?> findHierarchicalParent(final DataObject child) {
if (child instanceof ChildOf) {
}
/**
- * Returns root package name for suplied package name.
+ * Returns root package name for supplied package name.
*
- * @param pkg Package for which find model root package.
+ * @param name Package for which find model root package.
* @return Package of model root.
*/
public static String getModelRootPackageName(final String name) {
* @param type YANG Modeled Entity derived from DataContainer
* @return Iterable of all data children, which have YANG modeled entity
*/
- @SuppressWarnings("unchecked")
public static Map<Class<?>,Method> getChildrenClassToMethod(final Class<?> type) {
checkArgument(type != null, "Target type must not be null");
checkArgument(DataContainer.class.isAssignableFrom(type), "Supplied type must be derived from DataContainer");
* @return true if and only if classes represents same data.
*/
@SuppressWarnings({"rawtypes","unchecked"})
- public static boolean isSubstitutionFor(Class potential, Class target) {
+ public static boolean isSubstitutionFor(final Class potential, final Class target) {
HashSet<Class> subImplemented = Sets.newHashSet(potential.getInterfaces());
HashSet<Class> targetImplemented = Sets.newHashSet(target.getInterfaces());
if(!subImplemented.equals(targetImplemented)) {