Retrieves the ClassLocation for the supplied aNode.

@param aNode          A non-null DOM Node.
@param classLocations The set of known ClassLocations, extracted from the JavaDocs.
@return the ClassLocation matching the supplied Node
966790
public static ClassLocation getClassLocation(final Node aNode, final Set<ClassLocation> classLocations) {


        if (aNode != null) {

            // The LocalName of the supplied DOM Node should be either "complexType" or "simpleType".
            final String nodeLocalName = aNode.getLocalName();
            final boolean acceptableType = "complexType".equalsIgnoreCase(nodeLocalName)
                    || "simpleType".equalsIgnoreCase(nodeLocalName);

            if (acceptableType) {

                final String nodeClassName = DomHelper.getNameAttribute(aNode);
                for (ClassLocation current : classLocations) {

                    // TODO: Ensure that the namespace of the supplied aNode matches the expected namespace.

                    // Issue #25: Handle XML Type renaming.
                    final String effectiveClassName = current.getAnnotationRenamedTo() == null
                            ? current.getClassName()
                            : current.getAnnotationRenamedTo();
                    if (effectiveClassName.equalsIgnoreCase(nodeClassName)) {
                        return current;
                    }
                }
            }
        }

        // Nothing found
        return null;
    }
252637
@Nullable public Location getLocation(final String locationUUID) throws FlexiantException {

        final Cluster cluster = this.getCluster(locationUUID);
        if (cluster != null) {
            return Location.from(cluster);
        }
        final Vdc vdc = this.getVdc(locationUUID);
        if (vdc != null) {
            final Cluster clusterofVDC = this.getCluster(vdc.getClusterUUID());
            checkState(clusterofVDC != null, String.format(
                "Error while retrieving cluster of vdc %s. VDC is in cluster %s, but this cluster "
                    + "does not exist. Looks like the vdc is corrupted.", vdc,
                vdc.getClusterUUID()));
            return Location.from(vdc, clusterofVDC);
        }
        return null;
    }
432195
public static boolean isNamedElement(final Node aNode) {

        final boolean isElementNode = aNode != null && aNode.getNodeType() == Node.ELEMENT_NODE;

        return isElementNode
                && getNamedAttribute(aNode, NAME_ATTRIBUTE) != null
                && !getNamedAttribute(aNode, NAME_ATTRIBUTE).isEmpty();
    }
995905
public static boolean isTrait(final ClassNode cNode) {
        return cNode!=null
                && ((cNode.isInterface() && !cNode.getAnnotations(TRAIT_CLASSNODE).isEmpty())
                    || isAnnotatedWithTrait(cNode));
    }
1017595
public static String getLocalClassPath(ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        return ((EnvironmentClassLoader) loader).getLocalClassPath();
      }
    }
    
    return DynamicClassLoader.getSystemClassPath();
  }
7390
private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {
        return (element != null) ? element.getAnnotation(annotationClass) : null;
    }
124244
function getCommentedClassNode(node) {
    if (node.type !== "ClassBody") {
        return null;
    }
    // look for a constructor() and then look for property tags which we can annotate with.
    var constructNode = null;
    for (var i = 0; i < node.body.length; i++) {
        if (node.body[i].kind === "constructor" && node.body[i].type === "MethodDefinition") {
            constructNode = node.body[i];
        }
    }

    if (!constructNode || !constructNode.leadingComments) {
        return null;
    }

    // check for @property JSDoc on the constructor
    var constructDocs = null;
    for (var i=0; i<constructNode.leadingComments.length; i++) {
        if (constructNode.leadingComments[i].type === "Block") {
            constructDocs = extractJsdoc(constructNode.leadingComments[i].value);
            break;
        }
    }
    return {
        node: node,
        jsdoc: constructDocs
    };
}
697599
@PerformanceSensitive
    public Class<?> getCallerClass(final Class<?> anchor) {
        boolean next = false;
        Class<?> clazz;
        for (int i = 2; null != (clazz = getCallerClass(i)); i++) {
            if (anchor.equals(clazz)) {
                next = true;
                continue;
            }
            if (next) {
                return clazz;
            }
        }
        return Object.class;
    }
489134
public static Map<String, MethodNode> getDeclaredMethodsFromSuper(ClassNode cNode) {
        ClassNode parent = cNode.getSuperClass();
        if (parent == null) {
            return new HashMap<String, MethodNode>();
        }
        return parent.getDeclaredMethodsMap();
    }
961383
@Requires({
    "parent != null",
    "annotation != null"
  })
  @Ensures("result != null")
  @SuppressWarnings("unchecked")
  protected List<Long> getLineNumbers(Element parent,
                                      AnnotationMirror annotation) {
    if (JavaUtils.classExists("com.sun.source.util.Trees")) {
      try {
        return (List<Long>) Class
            .forName("com.google.java.contract.core.apt.JavacUtils")
            .getMethod("getLineNumbers", ProcessingEnvironment.class,
                       Element.class, AnnotationMirror.class)
            .invoke(null, utils.processingEnv, parent, annotation);
      } catch (Exception e) {
        return Collections.emptyList();
      }
    } else {
      return Collections.emptyList();
    }
  }
283223
public static List<Method> getAnnotatedMethods(final Class<?> cls, final Class<? extends Annotation> annotationClass) {
        final List<Method> methodList = new ArrayList<>();

        // Retrieve annotation even when they are wrapped into OnWaves
        for (final Method m : cls.getDeclaredMethods()) {
            if (m.getAnnotationsByType(annotationClass).length > 0) {
                methodList.add(m);
            }
        }

        // Add implemented interfaces methods
        for (final Class<?> i : cls.getInterfaces()) {
            methodList.addAll(getAnnotatedMethods(i, annotationClass));
        }

        // Add super class methods
        if (cls.getSuperclass() != null) {
            methodList.addAll(getAnnotatedMethods(cls.getSuperclass(), annotationClass));
        }

        return methodList;
    }
1028687
public Class<?> getMappingClass(Class<?> from) {
		if (mapping != null) {
			Class<?> ret = mapping.get(from);
			return ret != null ? ret : from;
		} else {
			return from;
		}
	}
829110
private DatanodeDescriptor getDatanode(DatanodeID node) {
    if (node == null) {
      return null;
    }
    DatanodeDescriptor ds = null;
    try {
      ds = namesystem.getDatanode(node);
    } catch (Exception e) {
      // probably dead on unregistered datanode
      LOG.warn("Failover - caught exception when getting datanode", e);
      return null;
    }
    return ds;
  }
45123
public static boolean isAnnotatedWithTrait(final ClassNode cNode) {
        List<AnnotationNode> traitAnn = cNode.getAnnotations(Traits.TRAIT_CLASSNODE);
        return traitAnn != null && !traitAnn.isEmpty();
    }
529724
@Nonnull
  public static <T extends IHCNode> T getPreparedNode (@Nonnull final T aNode,
                                                       @Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode,
                                                       @Nonnull final IHCConversionSettingsToNode aConversionSettings)
  {
    // Run the global customizer
    aNode.customizeNode (aConversionSettings.getCustomizer (), aConversionSettings.getHTMLVersion (), aTargetNode);

    // finalize the node
    aNode.finalizeNodeState (aConversionSettings, aTargetNode);

    // Consistency check
    aNode.consistencyCheck (aConversionSettings);

    // No forced registration here
    final boolean bForcedResourceRegistration = false;
    aNode.registerExternalResources (aConversionSettings, bForcedResourceRegistration);

    return aNode;
  }
527535
public static URL getLocation(Class self) {
        CodeSource codeSource = self.getProtectionDomain().getCodeSource();

        return null == codeSource ? null : codeSource.getLocation();
    }
1298217
@Override
    public JavaClassBuilderAt at(TypeReferenceLocation... locations)
    {
        if (locations != null)
            this.locations = Arrays.asList(locations);
        return this;
    }