All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.stjs.generator.utils.Scopes Maven / Gradle / Ivy

There is a newer version: 3.3.2.2
Show newest version
package org.stjs.generator.utils;

import javax.lang.model.element.Element;

import com.sun.source.tree.Scope;

public final class Scopes {
	private Scopes() {
		// private
	}

	public static Element findElement(Scope currentScope, String name) {
		for (Element element : currentScope.getLocalElements()) {
			if (name.equals(element.getSimpleName().toString())) {
				return element;
			}
		}
		if (currentScope.getEnclosingScope() != null) {
			return findElement(currentScope.getEnclosingScope(), name);
		}
		return null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy