Invoke the underlying visitor for the given element.

@param element            The element to visit
@param annotationMetadata The annotation data for the node

@return The element if one was created or null
764120
public @Nullable io.micronaut.inject.ast.Element visit(
            Element element, AnnotationMetadata annotationMetadata) {
        if (element instanceof VariableElement) {
            final JavaFieldElement e = new JavaFieldElement(
                    (VariableElement) element,
                    annotationMetadata,
                    visitorContext);
            visitor.visitField(
                    e,
                    visitorContext
            );
            return e;
        } else if (element instanceof ExecutableElement) {
            ExecutableElement executableElement = (ExecutableElement) element;
            if (executableElement.getSimpleName().toString().equals("<init>")) {
                final JavaConstructorElement e = new JavaConstructorElement(
                        executableElement,
                        annotationMetadata, visitorContext);
                visitor.visitConstructor(
                        e,
                        visitorContext
                );
                return e;
            } else {
                final JavaMethodElement e = new JavaMethodElement(
                        executableElement,
                        annotationMetadata, visitorContext);
                visitor.visitMethod(
                        e,
                        visitorContext
                );
                return e;
            }
        } else if (element instanceof TypeElement) {
            TypeElement typeElement = (TypeElement) element;
            boolean isEnum = JavaModelUtils.resolveKind(typeElement, ElementKind.ENUM).isPresent();
            if (isEnum) {
                final JavaEnumElement e = new JavaEnumElement(
                        typeElement,
                        annotationMetadata,
                        visitorContext,
                        Collections.emptyList());
                visitor.visitClass(
                        e,
                        visitorContext
                );
                return e;
            } else {
                final JavaClassElement e = new JavaClassElement(
                        typeElement,
                        annotationMetadata,
                        visitorContext);
                visitor.visitClass(
                        e,
                        visitorContext
                );
                return e;
            }
        }
        return null;
    }
462158
private static <T> Extension<T> parseBinderExtensionElement(Element element) {

        @SuppressWarnings("unchecked")
		Class<T> providerClass = (Class<T>)lookupClass(element.getAttribute("class"));
        
        Class<?> implementationClass = lookupClass(element.getAttribute("implementationClass"));

        if (providerClass == null) {
            throw new IllegalStateException("Referenced class {" + element.getAttribute("class")
                    + "} could not be found");
        }
        if (implementationClass == null) {
            throw new IllegalStateException("Referenced implementation class {" + element.getAttribute("implementationClass")
                    + "} could not be found");
        }
        if (providerClass.isAssignableFrom(implementationClass)) {
            throw new IllegalStateException("Referenced class {" + element.getAttribute("class")
                    + "} did not implement BindingProvider");
        }

		try {
			@SuppressWarnings("unchecked")
			final Class<? extends T> myImplementationClass = (Class<T>) implementationClass.newInstance();
			return new Extension<T>(providerClass, myImplementationClass);
		} catch (InstantiationException e) {
            throw new IllegalStateException("Referenced implementation class {" + element.getAttribute("implementationClass")
                    + "} could not be instantiated");
		} catch (IllegalAccessException e) {
            throw new IllegalStateException("Referenced implementation class {" + element.getAttribute("implementationClass")
                    + "} could not be accessed");
		}
    }
509781
public static ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(Element element,
      final Class<? extends Annotation> annotationType) {
    List<? extends AnnotationMirror> annotations = element.getAnnotationMirrors();
    return FluentIterable.from(annotations)
        .filter(new Predicate<AnnotationMirror>() {
          @Override public boolean apply(AnnotationMirror input) {
            return isAnnotationPresent(input.getAnnotationType().asElement(), annotationType);
          }
        })
        .toSet();
  }
266769
public static Optional<AnnotationMirror> findAnnotationMirror(
      Element element, String annotationClassName) {
    for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
      TypeElement annotationTypeElement =
          (TypeElement) (annotationMirror.getAnnotationType().asElement());
      if (annotationTypeElement.getQualifiedName().contentEquals(annotationClassName)) {
        return Optional.of(annotationMirror);
      }
    }
    return Optional.empty();
  }
1318749
private Link getAnchorLink(Element element) {
    SyntheticLinkResource resource = new SyntheticLinkResource(resourceResolver);
    ValueMap resourceProps = resource.getValueMap();

    // get link metadata from data element
    boolean foundMetadata = getAnchorMetadataFromData(resourceProps, element);
    if (!foundMetadata) {
      // support for legacy metadata stored in single "data" attribute
      foundMetadata = getAnchorLegacyMetadataFromSingleData(resourceProps, element);
      if (!foundMetadata) {
        // support for legacy metadata stored in rel attribute
        getAnchorLegacyMetadataFromRel(resourceProps, element);
      }
    }

    // build anchor via linkhandler
    return linkHandler.get(resource).build();
  }
55495
public void visitAnnotations(AnnotatedNode node) {
        super.visitAnnotations(node);
        for (AnnotationNode annotation : node.getAnnotations()) {
            if (transforms.containsKey(annotation)) {
                targetNodes.add(new ASTNode[]{annotation, node});
            }
        }
    }
1191277
public static ClassName get(TypeElement element) {
    checkNotNull(element, "element == null");
    String simpleName = element.getSimpleName().toString();

    return element.getEnclosingElement().accept(new SimpleElementVisitor8<ClassName, Void>() {
      @Override public ClassName visitPackage(PackageElement packageElement, Void p) {
        return new ClassName(packageElement.getQualifiedName().toString(), null, simpleName);
      }

      @Override public ClassName visitType(TypeElement enclosingClass, Void p) {
        return ClassName.get(enclosingClass).nestedClass(simpleName);
      }

      @Override public ClassName visitUnknown(Element unknown, Void p) {
        return get("", simpleName);
      }

      @Override public ClassName defaultAction(Element enclosingElement, Void p) {
        throw new IllegalArgumentException("Unexpected type nesting: " + element);
      }
    }, null);
  }
432412
public static Element getElementNode(final Element element, final DitaClass classValue) {
        final NodeList list = element.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            final Node node = list.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                final Element child = (Element) node;
                if (classValue.matches(child)) {
                    return child;
                }
            }
        }
        return null;
    }
94617
public static void forEachAnnotations(Element currentElement, AnnotationFilter filter, AnnotationFoundListener listener) {
		final Elements elementUtils=BaseProcessor.elementUtils;
		List<? extends AnnotationMirror> annotationList = elementUtils.getAllAnnotationMirrors(currentElement);
		String annotationClassName;
		// boolean valid=true;

		for (AnnotationMirror annotation : annotationList) {
			Map<String, String> values = new HashMap<String, String>();
			annotationClassName = annotation.getAnnotationType().asElement().toString();

			if (filter != null && !filter.isAccepted(annotationClassName)) {
				continue;
			}

			values.clear();
			for (Entry<? extends ExecutableElement, ? extends AnnotationValue> annotationItem : elementUtils.getElementValuesWithDefaults(annotation).entrySet()) {
				String value = annotationItem.getValue().toString();
				if (value.startsWith("\"") && value.endsWith("\"")) {
					value = value.substring(1);
					value = value.substring(0, value.length() - 1);
				}
				values.put(annotationItem.getKey().getSimpleName().toString(), value);
			}

			if (listener != null) {
				listener.onAcceptAnnotation(currentElement, annotationClassName, values);
			}
		}				
	}
998538
static String getMetaData(Element element) {
		String label = element.getAttributeNS(INKSCAPE, "label");
		if ((label != null) && (!label.equals(""))) {
			return label;
		}
		
		return element.getAttribute("id");
	}
661938
protected Converter getConverterForElementWithUseAnnotation(AnnotatedElement element) {
        Class<? extends Converter> clazz = element.getAnnotation(Use.class).value();
        try {
            return clazz.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new PropertyLoaderException(String.format(
                    "Can't instance converter <%s>", clazz), e);
        }
    }
1278544
public static ILocalizableString get(AnnotatedElement element, String name) {
		for (LocalizableProperty p : element.getAnnotationsByType(LocalizableProperty.class)) {
			if (!p.name().equals(name)) continue;
			String ns = p.namespace();
			if (ns.length() == 0) {
				LocalizableNamespace lns = element.getAnnotation(LocalizableNamespace.class);
				if (lns == null) {
					if (element instanceof Member)
						lns = ((Member)element).getDeclaringClass().getAnnotation(LocalizableNamespace.class);
				}
				if (lns != null)
					ns = lns.value();
			}
			String[] values = p.values();
			Object[] v = new Object[values.length];
			for (int i = 0; i < values.length; ++i) v[i] = values[i];
			return new LocalizableString(ns, p.key(), v);
		}
		for (Property p : element.getAnnotationsByType(Property.class)) {
			if (!p.name().equals(name)) continue;
			return new FixedLocalizedString(p.value());
		}
		return null;
	}
237170
@SuppressWarnings("unchecked")
	private static BindingConfigurationEntry parseBindingConfigurationEntryElement(Element element) {

    	Class<?> bindingClass = null;
    	Class<?> sourceClass = null;
    	Class<?> targetClass = null;
        Method toMethod = null;
        Method fromMethod = null;
        Constructor<?> fromConstructor = null;
        Class<? extends Annotation> qualifier = DefaultBinding.class;
        
        if (element.getAttribute("class").length() > 0) {
        	bindingClass = lookupClass(element.getAttribute("class"));
        }
        
        if (element.getAttribute("sourceClass").length() > 0) {
            sourceClass = lookupClass(element.getAttribute("sourceClass"));
        }
        if (element.getAttribute("targetClass").length() > 0) {
        	targetClass = lookupClass(element.getAttribute("targetClass"));
        }

        if (element.getAttribute("qualifier").length() > 0) {
        	
            qualifier = (Class<? extends Annotation>) lookupClass(element.getAttribute("qualifier"));

            if (qualifier.getAnnotation(BindingScope.class) == null) {
                    throw new IllegalStateException("Qualifier class {" + element.getAttribute("qualifier")
                            + "} was not marked as BindingScope");
            }
        }

        if (bindingClass != null) {
	        for (Node next : new IterableNodeList(element.getChildNodes())) {
	            if (Node.ELEMENT_NODE == next.getNodeType()) {
	                Element childElement = (Element) next;
	                if (BINDINGS_NAMESPACE.equals(element.getNamespaceURI())
	                        && "toMethod".equals(element.getLocalName())) {
	
	                    String toMethodName = childElement.getTextContent();
	
	                    try {
	                        toMethod = bindingClass.getMethod(toMethodName, new Class[] { targetClass });
	                    } catch (SecurityException e) {
	                    } catch (NoSuchMethodException e) {
	                    }
	                    if (toMethod != null && (!String.class.equals(toMethod.getReturnType())
	                            || !Modifier.isStatic(toMethod.getModifiers()))) {
	                        toMethod = null;
	                    }
	                    if (toMethod == null && bindingClass.equals(targetClass)) {
	                        try {
	                            toMethod = bindingClass.getMethod(toMethodName, new Class[] {});
	                        } catch (SecurityException e) {
	                        } catch (NoSuchMethodException e) {
	                        }
	                        if (toMethod != null && Modifier.isStatic(toMethod.getModifiers())) {
	                            toMethod = null;
	                        }
	                    }
	
	                } else if (BINDINGS_NAMESPACE.equals(element.getNamespaceURI())
	                        && "fromMethod".equals(element.getLocalName())) {
	
	                    String fromMethodName = childElement.getTextContent();
	
	                    try {
	                        fromMethod = bindingClass.getMethod(fromMethodName, new Class[] { String.class });
	                    } catch (SecurityException e) {
	                    } catch (NoSuchMethodException e) {
	                    }
	                    if (fromMethod != null && ((targetClass != null && !targetClass.isAssignableFrom(fromMethod.getReturnType()))
	                    	|| !Modifier.isStatic(fromMethod.getModifiers()))) {
	                    	fromMethod = null;
	                    }
	
	                } else if (BINDINGS_NAMESPACE.equals(element.getNamespaceURI())
	                        && "fromConstructor".equals(element.getLocalName())) {
	
	                    try {
	                        fromConstructor = bindingClass.getConstructor(new Class[] { String.class });
	                    } catch (SecurityException e) {
	                    } catch (NoSuchMethodException e) {
	                    }
	                }
	            }
	        }
        }

        if (bindingClass == null) {

        	if (sourceClass == null) {
        		throw new IllegalStateException("If bindingClass is not populated, sourceClass must be present");
        	}
        	if (targetClass == null) {
        		throw new IllegalStateException("If bindingClass is not populated, targetClass must be present");
        	}
        	if (fromMethod != null && fromConstructor != null) {
        		throw new IllegalStateException("If fromMethod is populated, fromConstructor must not be present");
        	}

        	if (fromMethod == null) {
        	
        		return new BindingConfigurationEntry(sourceClass, targetClass, qualifier, toMethod, fromConstructor);
        	} else {
        		
        		return new BindingConfigurationEntry(sourceClass, targetClass, qualifier, toMethod, fromMethod);
        	}
        } else {
        	if (sourceClass != null) {
        		throw new IllegalStateException("If bindingClass is populated, sourceClass must not be present");
        	}
        	if (targetClass != null) {
        		throw new IllegalStateException("If bindingClass is populated, targetClass must not be present");
        	}
        	if (toMethod != null) {
        		throw new IllegalStateException("If bindingClass is populated, toMethod must not be present");
        	}
        	if (fromMethod != null) {
        		throw new IllegalStateException("If bindingClass is populated, fromMethod must not be present");
        	}
        	if (fromConstructor != null) {
        		throw new IllegalStateException("If bindingClass is populated, fromConstructor must not be present");
        	}
        	
        	return new BindingConfigurationEntry(bindingClass, qualifier);
        }
    }
1278248
private function guessProperty(ClassMetadata $metadata, $element)
    {
        // Is it the element the actual property
        if ($metadata->hasPropertyMetadata($element)) {
            return $element;
        }

        // Is it a camelized property
        $camelized = $this->camelize($element);
        if ($metadata->hasPropertyMetadata($camelized)) {
            return $camelized;
        }

        return null;
    }
379991
public static String getAnnotationTableName(AnnotatedElement element) {
        String result = "";
        result = DatabaseTableConfig.extractTableName((Class<?>) element);
        return result;
    }
904892
public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor) {
    NodeList nl = ele.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element && nodeNameEquals(node, META_ELEMENT)) {
        Element metaElement = (Element) node;
        String key = metaElement.getAttribute(KEY_ATTRIBUTE);
        String value = metaElement.getAttribute(VALUE_ATTRIBUTE);
        BeanMetadataAttribute attribute = new BeanMetadataAttribute(key, value);
        attribute.setSource(extractSource(metaElement));
        attributeAccessor.addMetadataAttribute(attribute);
      }
    }
  }
80411
private void getAnchorLegacyMetadataFromRel(ValueMap resourceProps, Element element) {
    // Check href attribute - do not change elements with no href or links to anchor names
    String href = element.getAttributeValue("href");
    String linkWindowTarget = element.getAttributeValue("target");
    if (href == null || href.startsWith("#")) {
      return;
    }

    // get link metadata from rel element
    JSONObject metadata = null;
    String metadataString = element.getAttributeValue("rel");
    if (StringUtils.isNotEmpty(metadataString)) {
      try {
        metadata = new JSONObject(metadataString);
      }
      catch (JSONException ex) {
        log.debug("Invalid link metadata: " + metadataString, ex);
      }
    }
    if (metadata == null) {
      metadata = new JSONObject();
    }

    // transform link metadata to virtual JCR resource with JCR properties
    JSONArray metadataPropertyNames = metadata.names();
    if (metadataPropertyNames != null) {
      for (int i = 0; i < metadataPropertyNames.length(); i++) {
        String metadataPropertyName = metadataPropertyNames.optString(i);

        // check if value is array
        JSONArray valueArray = metadata.optJSONArray(metadataPropertyName);
        if (valueArray != null) {
          // store array values
          List<String> values = new ArrayList<String>();
          for (int j = 0; j < valueArray.length(); j++) {
            values.add(valueArray.optString(j));
          }
          resourceProps.put(metadataPropertyName, values.toArray(new String[values.size()]));
        }
        else {
          // store simple value
          Object value = metadata.opt(metadataPropertyName);
          if (value != null) {
            resourceProps.put(metadataPropertyName, value);
          }
        }
      }
    }

    // detect link type
    LinkType linkType = null;
    String linkTypeString = resourceProps.get(LinkNameConstants.PN_LINK_TYPE, String.class);
    for (Class<? extends LinkType> candidateClass : linkHandlerConfig.getLinkTypes()) {
      LinkType candidate = AdaptTo.notNull(adaptable, candidateClass);
      if (StringUtils.isNotEmpty(linkTypeString)) {
        if (StringUtils.equals(linkTypeString, candidate.getId())) {
          linkType = candidate;
          break;
        }
      }
      else if (candidate.accepts(href)) {
        linkType = candidate;
        break;
      }
    }
    if (linkType == null) {
      // skip further processing if link type was not detected
      return;
    }

    // workaround: strip off ".html" extension if it was added automatically by the RTE
    if (linkType instanceof InternalLinkType || linkType instanceof MediaLinkType) {
      String htmlSuffix = "." + FileExtension.HTML;
      if (StringUtils.endsWith(href, htmlSuffix)) {
        href = StringUtils.substringBeforeLast(href, htmlSuffix);
      }
    }

    // store link reference (property depending on link type)
    resourceProps.put(linkType.getPrimaryLinkRefProperty(), href);
    resourceProps.put(LinkNameConstants.PN_LINK_WINDOW_TARGET, linkWindowTarget);

  }