code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Nonnull
public static String ensureNonNullAndNonEmpty(@Nullable final String value, @Nonnull @Constraint("notEmpty(X)") final String dflt) {
String result = value;
if (result == null || result.isEmpty()) {
assertFalse("Default value must not be empty", assertNotNull("Default value must not be null", df... | java |
@Nonnull
@Weight(Weight.Unit.VARIABLE)
public static byte[] packData(@Nonnull final byte[] data) {
final Deflater compressor = new Deflater(Deflater.BEST_COMPRESSION);
compressor.setInput(Assertions.assertNotNull(data));
compressor.finish();
final ByteArrayOutputStream resultData = new ByteArrayOutp... | java |
@Nonnull
@Weight(Weight.Unit.VARIABLE)
public static byte[] unpackData(@Nonnull final byte[] data) {
final Inflater decompressor = new Inflater();
decompressor.setInput(Assertions.assertNotNull(data));
final ByteArrayOutputStream outStream = new ByteArrayOutputStream(data.length * 2);
final byte[] b... | java |
@Weight(Weight.Unit.VARIABLE)
public static boolean silentSleep(final long milliseconds) {
boolean result = true;
try {
Thread.sleep(milliseconds);
} catch (InterruptedException ex) {
result = false;
Thread.currentThread().interrupt();
}
return result;
} | java |
@Weight(Weight.Unit.VARIABLE)
@Nonnull
public static StackTraceElement stackElement() {
final StackTraceElement[] allElements = Thread.currentThread().getStackTrace();
return allElements[2];
} | java |
@Weight(Weight.Unit.VARIABLE)
public static void fireError(@Nonnull final String text, @Nonnull final Throwable error) {
for (final MetaErrorListener p : ERROR_LISTENERS) {
p.onDetectedError(text, error);
}
} | java |
@Nonnull
public ExpressionTreeElement addSubTree(@Nonnull final ExpressionTree tree) {
assertNotEmptySlot();
final ExpressionTreeElement root = tree.getRoot();
if (!root.isEmptySlot()) {
root.makeMaxPriority();
addElementToNextFreeSlot(root);
}
return this;
} | java |
public boolean replaceElement(@Nonnull final ExpressionTreeElement oldOne, @Nonnull final ExpressionTreeElement newOne) {
assertNotEmptySlot();
if (oldOne == null) {
throw new PreprocessorException("[Expression]The old element is null", this.sourceString, this.includeStack, null);
}
if (newOne =... | java |
@Nullable
public ExpressionTreeElement addTreeElement(@Nonnull final ExpressionTreeElement element) {
assertNotEmptySlot();
assertNotNull("The element is null", element);
final int newElementPriority = element.getPriority();
ExpressionTreeElement result = this;
final ExpressionTreeElement paren... | java |
public void fillArguments(@Nonnull @MustNotContainNull final List<ExpressionTree> arguments) {
assertNotEmptySlot();
if (arguments == null) {
throw new PreprocessorException("[Expression]Argument list is null", this.sourceString, this.includeStack, null);
}
if (childElements.length != arguments.... | java |
private void addElementToNextFreeSlot(@Nonnull final ExpressionTreeElement element) {
if (element == null) {
throw new PreprocessorException("[Expression]Element is null", this.sourceString, this.includeStack, null);
}
if (childElements.length == 0) {
throw new PreprocessorException("[Expressio... | java |
public void postProcess() {
if (!this.isEmptySlot()) {
switch (savedItem.getExpressionItemType()) {
case OPERATOR: {
if (savedItem == OPERATOR_SUB) {
if (!childElements[0].isEmptySlot() && childElements[1].isEmptySlot()) {
final ExpressionTreeElement left = childEl... | java |
@Nullable
public static <E extends AbstractFunction> E findForClass(@Nonnull final Class<E> functionClass) {
E result = null;
for (final AbstractFunction function : getAllFunctions()) {
if (function.getClass() == functionClass) {
result = functionClass.cast(function);
break;
}
... | java |
public void registerSpecialVariableProcessor(@Nonnull final SpecialVariableProcessor processor) {
assertNotNull("Processor is null", processor);
for (final String varName : processor.getVariableNames()) {
assertNotNull("A Special Var name is null", varName);
if (mapVariableNameToSpecialVarProcessor... | java |
public void logInfo(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.info(text);
}
} | java |
public void logError(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.error(text);
}
} | java |
public void logDebug(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.debug(text);
}
} | java |
public void logWarning(@Nullable final String text) {
if (text != null || this.preprocessorLogger != null) {
this.preprocessorLogger.warning(text);
}
} | java |
public void setSharedResource(@Nonnull final String name, @Nonnull final Object obj) {
assertNotNull("Name is null", name);
assertNotNull("Object is null", obj);
sharedResources.put(name, obj);
} | java |
@Nullable
public Object getSharedResource(@Nonnull final String name) {
assertNotNull("Name is null", name);
return sharedResources.get(name);
} | java |
@Nullable
public Object removeSharedResource(@Nonnull final String name) {
assertNotNull("Name is null", name);
return sharedResources.remove(name);
} | java |
@Nonnull
public PreprocessorContext setSources(@Nonnull @MustNotContainNull final List<String> folderPaths) {
this.sources.clear();
this.sources.addAll(assertDoesntContainNull(folderPaths).stream().map(x -> new SourceFolder(this.baseDir, x)).collect(Collectors.toList()));
return this;
} | java |
@Nonnull
public PreprocessorContext setExtensions(@Nonnull @MustNotContainNull final List<String> extensions) {
this.extensions = new HashSet<>(assertDoesntContainNull(extensions));
return this;
} | java |
public final boolean isFileAllowedForPreprocessing(@Nullable final File file) {
boolean result = false;
if (file != null && file.isFile() && file.length() != 0L) {
result = this.extensions.contains(PreprocessorUtils.getFileExtension(file));
}
return result;
} | java |
public final boolean isFileExcludedByExtension(@Nullable final File file) {
return file == null || !file.isFile() || this.excludeExtensions.contains(PreprocessorUtils.getFileExtension(file));
} | java |
@Nonnull
public PreprocessorContext setExcludeExtensions(@Nonnull @MustNotContainNull final List<String> extensions) {
this.excludeExtensions = new HashSet<>(assertDoesntContainNull(extensions));
return this;
} | java |
@Nonnull
public PreprocessorContext setLocalVariable(@Nonnull final String name, @Nonnull final Value value) {
assertNotNull("Variable name is null", name);
assertNotNull("Value is null", value);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.i... | java |
@Nonnull
public PreprocessorContext removeLocalVariable(@Nonnull final String name) {
assertNotNull("Variable name is null", name);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
throw makeException("Empty variable name", null);
... | java |
@Nullable
public Value getLocalVariable(@Nullable final String name) {
if (name == null) {
return null;
}
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
return null;
}
return localVarTable.get(normalized);
} | java |
public boolean containsLocalVariable(@Nullable final String name) {
if (name == null) {
return false;
}
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
return false;
}
return localVarTable.containsKey(normalized);... | java |
@Nonnull
public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) {
assertNotNull("Variable name is null", name);
final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalizedName.isEmpty()) {
throw makeExcept... | java |
public boolean containsGlobalVariable(@Nullable final String name) {
if (name == null) {
return false;
}
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
return false;
}
return mapVariableNameToSpecialVarProcessor.c... | java |
public boolean isGlobalVariable(@Nullable final String variableName) {
boolean result = false;
if (variableName != null) {
final String normalized = PreprocessorUtils.normalizeVariableName(variableName);
result = this.globalVarTable.containsKey(normalized) || mapVariableNameToSpecialVarProcessor.con... | java |
public boolean isLocalVariable(@Nullable final String variableName) {
boolean result = false;
if (variableName != null) {
final String normalized = PreprocessorUtils.normalizeVariableName(variableName);
result = this.localVarTable.containsKey(normalized);
}
return result;
} | java |
@Nonnull
public File createDestinationFileForPath(@Nonnull final String path) {
assertNotNull("Path is null", path);
if (path.isEmpty()) {
throw makeException("File name is empty", null);
}
return new File(this.getTarget(), path);
} | java |
@Nonnull
public File findFileInSources(@Nullable final String path) throws IOException {
if (path == null) {
throw makeException("File path is null", null);
}
if (path.trim().isEmpty()) {
throw makeException("File path is empty", null);
}
File result = null;
final TextFileDataCo... | java |
@Nonnull
public static Error fail(@Nullable final String message) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "failed"));
MetaErrorListeners.fireError("Asserion error", error);
if (true) {
throw error;
}
return error;
} | java |
@Nonnull
public static <T> T[] assertDoesntContainNull(@Nonnull final T[] array) {
assertNotNull(array);
for (final T obj : array) {
if (obj == null) {
final AssertionError error = new AssertionError("Array must not contain NULL");
MetaErrorListeners.fireError("Asserion error", error);
... | java |
public static void assertTrue(@Nullable final String message, final boolean condition) {
if (!condition) {
final AssertionError error = new AssertionError(GetUtils.ensureNonNull(message, "Condition must be TRUE"));
MetaErrorListeners.fireError(error.getMessage(), error);
throw error;
}
} | java |
public static <T> T assertEquals(@Nullable final T etalon, @Nullable final T value) {
if (etalon == null) {
assertNull(value);
} else {
if (!(etalon == value || etalon.equals(value))) {
final AssertionError error = new AssertionError("Value is not equal to etalon");
MetaErrorListener... | java |
@Nonnull
public static <T extends Collection<?>> T assertDoesntContainNull(@Nonnull final T collection) {
assertNotNull(collection);
for (final Object obj : collection) {
assertNotNull(obj);
}
return collection;
} | java |
@Nonnull
public static <T extends Disposable> T assertNotDisposed(@Nonnull final T disposable) {
if (disposable.isDisposed()) {
final AlreadyDisposedError error = new AlreadyDisposedError("Object already disposed");
MetaErrorListeners.fireError("Asserion error", error);
throw error;
}
re... | java |
public void addItem(@Nonnull final ExpressionItem item) {
if (item == null) {
throw new PreprocessorException("[Expression]Item is null", this.sources, this.includeStack, null);
}
if (last.isEmptySlot()) {
last = new ExpressionTreeElement(item, this.includeStack, this.sources);
} else {
... | java |
public void addTree(@Nonnull final ExpressionTree tree) {
assertNotNull("Tree is null", tree);
if (last.isEmptySlot()) {
final ExpressionTreeElement thatTreeRoot = tree.getRoot();
if (!thatTreeRoot.isEmptySlot()) {
last = thatTreeRoot;
last.makeMaxPriority();
}
} else {
... | java |
@Nonnull
public ExpressionTreeElement getRoot() {
if (last.isEmptySlot()) {
return this.last;
} else {
ExpressionTreeElement element = last;
while (!Thread.currentThread().isInterrupted()) {
final ExpressionTreeElement next = element.getParent();
if (next == null) {
... | java |
@Weight(Weight.Unit.NORMAL)
public static Deferred defer(@Nonnull final Deferred deferred) {
REGISTRY.get().add(assertNotNull(deferred));
return deferred;
} | java |
@Weight(Weight.Unit.NORMAL)
public static Runnable defer(@Nonnull final Runnable runnable) {
assertNotNull(runnable);
defer(new Deferred() {
private static final long serialVersionUID = 2061489024868070733L;
private final Runnable value = runnable;
@Override
public void executeDeferre... | java |
@Weight(Weight.Unit.NORMAL)
public static Disposable defer(@Nonnull final Disposable disposable) {
assertNotNull(disposable);
defer(new Deferred() {
private static final long serialVersionUID = 7940162959962038010L;
private final Disposable value = disposable;
@Override
public void ex... | java |
@Weight(Weight.Unit.NORMAL)
public static void cancelAllDeferredActionsGlobally() {
final List<Deferred> list = REGISTRY.get();
list.clear();
REGISTRY.remove();
} | java |
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
public static void processDeferredActions() {
final int stackDepth = ThreadUtils.stackDepth();
final List<Deferred> list = REGISTRY.get();
final Iterator<Deferred> iterator = list.iterator();
while (iterator.h... | java |
@Weight(Weight.Unit.NORMAL)
public static boolean isEmpty() {
final boolean result = REGISTRY.get().isEmpty();
if (result) {
REGISTRY.remove();
}
return result;
} | java |
@Nonnull
public ExpressionTree parse(@Nonnull final String expressionStr, @Nonnull final PreprocessorContext context) throws IOException {
assertNotNull("Expression is null", expressionStr);
final PushbackReader reader = new PushbackReader(new StringReader(expressionStr));
final ExpressionTree result;
... | java |
@Nullable
public ExpressionItem readExpression(@Nonnull final PushbackReader reader, @Nonnull final ExpressionTree tree, @Nonnull final PreprocessorContext context, final boolean insideBracket, final boolean argument) throws IOException {
boolean working = true;
ExpressionItem result = null;
final FileP... | java |
@Nonnull
private ExpressionTree readFunction(@Nonnull final AbstractFunction function, @Nonnull final PushbackReader reader, @Nonnull final PreprocessorContext context, @Nullable @MustNotContainNull final FilePositionInfo[] includeStack, @Nullable final String sources) throws IOException {
final ExpressionItem ex... | java |
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
// WARNING! Don't make a call from methods of the class to not break stack depth!
public static void addPoint(@Nonnull final String timePointName, @Nonnull final TimeAlertListener listener) {
final List<TimeData> list = R... | java |
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
public static void checkPoints() {
final long time = System.currentTimeMillis();
final int stackDepth = ThreadUtils.stackDepth();
final List<TimeData> list = REGISTRY.get();
final Iterator<TimeData> iterator = ... | java |
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
public static void addGuard(@Nullable final String alertMessage,
@Constraint("X>0") final long maxAllowedDelayInMilliseconds,
@Nullable final TimeAlertListener timeAle... | java |
@Weight(Weight.Unit.NORMAL)
public static void cancelAll() {
final List<TimeData> list = REGISTRY.get();
list.clear();
REGISTRY.remove();
} | java |
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
public static void check() {
final long time = System.currentTimeMillis();
final int stackDepth = ThreadUtils.stackDepth();
final List<TimeData> list = REGISTRY.get();
final Iterator<TimeData> iterator = list.... | java |
@Nullable
public static <E extends AbstractOperator> E findForClass(@Nonnull final Class<E> operatorClass) {
for (final AbstractOperator operator : getAllOperators()) {
if (operator.getClass() == operatorClass) {
return operatorClass.cast(operator);
}
}
return null;
} | java |
@Nonnull
public String restoreStackTrace() {
return "THREAD_ID : " + this.threadDescriptor + this.eol + new String(this.packed ? IOUtils.unpackData(this.stacktrace) : this.stacktrace, UTF8);
} | java |
protected void assertNotDisposed() {
if (this.disposedFlag.get()) {
final AlreadyDisposedError error = new AlreadyDisposedError("Object already disposed");
MetaErrorListeners.fireError("Detected call to disposed object", error);
throw error;
}
} | java |
@Nonnull
public static Value evalTree(@Nonnull final ExpressionTree tree, @Nonnull final PreprocessorContext context) {
final Expression exp = new Expression(context, tree);
return exp.eval(context.getPreprocessingState());
} | java |
public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
GitHub github = GitHub.connectAnonymously();
GHOrganization organization = github.getOrganization(githubOrg);
Objects.notNull(organization, "No github organisation found... | java |
public void generateArchetypesFromGitRepoList(File file, File outputDir, List<String> dirs) throws IOException {
File cloneParentDir = new File(outputDir, "../git-clones");
if (cloneParentDir.exists()) {
Files.recursiveDelete(cloneParentDir);
}
Properties properties = new Pr... | java |
public void generateArchetypes(String containerType, File baseDir, File outputDir, boolean clean, List<String> dirs) throws IOException {
LOG.debug("Generating archetypes from {} to {}", baseDir.getCanonicalPath(), outputDir.getCanonicalPath());
File[] files = baseDir.listFiles();
if (files != n... | java |
private static boolean skipImport(File dir) {
String[] files = dir.list();
if (files != null) {
for (String name : files) {
if (".skipimport".equals(name)) {
return true;
}
}
}
return false;
} | java |
private boolean fileIncludesLine(File file, String matches) throws IOException {
for (String line: Files.readLines(file)) {
String trimmed = line.trim();
if (trimmed.equals(matches)) {
return true;
}
}
return false;
} | java |
protected void copyOtherFiles(File projectDir, File srcDir, File outDir, Replacement replaceFn, Set<String> extraIgnorefiles) throws IOException {
if (archetypeUtils.isValidFileToCopy(projectDir, srcDir, extraIgnorefiles)) {
if (srcDir.isFile()) {
copyFile(srcDir, outDir, replaceFn);... | java |
protected boolean isSourceFile(File file) {
String name = file.getName();
String extension = Files.getExtension(name).toLowerCase();
return sourceFileExtensions.contains(extension) || sourceFileNames.contains(name);
} | java |
protected boolean isValidRequiredPropertyName(String name) {
return !name.equals("basedir") && !name.startsWith("project.") && !name.startsWith("pom.") && !name.equals("package");
} | java |
protected boolean isSpecialPropertyName(String name) {
for (String special : specialVersions) {
if (special.equals(name)) {
return true;
}
}
return false;
} | java |
private boolean addPropertyElement(Element element, String elementName, String textContent) {
Document doc = element.getOwnerDocument();
Element newElement = doc.createElement(elementName);
newElement.setTextContent(textContent);
Text textNode = doc.createTextNode("\n ");
Nod... | java |
protected String removeInvalidHeaderCommentsAndProcessVelocityMacros(String text) {
String answer = "";
String[] lines = text.split("\r?\n");
for (String line : lines) {
String l = line.trim();
// a bit of Velocity here
if (!l.startsWith("##") && !l.startsWith... | java |
public File findRootPackage(File directory) throws IOException {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("Can't find package inside file. Argument should be valid directory.");
}
File[] children = directory.listFiles(new FileFilter() {
@Override... | java |
public boolean isValidSourceFileOrDir(File file) {
String name = file.getName();
return !isExcludedDotFile(name) && !excludeExtensions.contains(Files.getExtension(file.getName()));
} | java |
public void writeXmlDocument(Document document, File file) throws IOException {
try {
Transformer tr = transformerFactory.newTransformer();
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
tr.setOutputProperty(OutputKeys.INDENT, "yes");
FileOutputStream fileOut... | java |
public String writeXmlDocumentAsString(Document document) throws IOException {
try {
Transformer tr = transformerFactory.newTransformer();
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
tr.setOutputProperty(OutputKeys.INDENT, "yes");
StringWriter writer = new... | java |
public static void notNull(final Object object, final String argumentName) {
if (object == null) {
throw new NullPointerException(getMessage("null", argumentName));
}
} | java |
public static void notEmpty(final String aString, final String argumentName) {
// Check sanity
notNull(aString, argumentName);
if (aString.length() == 0) {
throw new IllegalArgumentException(getMessage("empty", argumentName));
}
} | java |
private String getNamespace(final Attr attribute) {
final Element parent = attribute.getOwnerElement();
return parent.getAttribute(NAMESPACE);
} | java |
public void restore() {
if (!restored) {
// Remove the extra Handler from the RootLogger
rootLogger.removeHandler(mavenLogHandler);
// Restore the original state to the Root logger
rootLogger.setLevel(originalRootLoggerLevel);
for (Handler current :... | java |
public static LoggingHandlerEnvironmentFacet create(final Log mavenLog,
final Class<? extends AbstractJaxbMojo> caller,
final String encoding) {
// Check sanity
Validate.notNull(mavenLog, "ma... | java |
public ThreadContextClassLoaderBuilder addURL(final URL anURL) {
// Check sanity
Validate.notNull(anURL, "anURL");
// Add the segment unless already added.
for (URL current : urlList) {
if (current.toString().equalsIgnoreCase(anURL.toString())) {
if (log.is... | java |
public static ThreadContextClassLoaderBuilder createFor(final ClassLoader classLoader,
final Log log,
final String encoding) {
// Check sanity
Validate.notNull(classLoader, "classLoad... | java |
public static ThreadContextClassLoaderBuilder createFor(final Class<?> aClass,
final Log log,
final String encoding) {
// Check sanity
Validate.notNull(aClass, "aClass");
// ... | java |
public static String getClassPathElement(final URL anURL, final String encoding) throws IllegalArgumentException {
// Check sanity
Validate.notNull(anURL, "anURL");
final String protocol = anURL.getProtocol();
String toReturn = null;
if (FILE.supports(protocol)) {
... | java |
protected String renderJavaDocTag(final String name, final String value, final SortableLocation location) {
final String nameKey = name != null ? name.trim() : "";
final String valueKey = value != null ? value.trim() : "";
// All Done.
return "(" + nameKey + "): " + harmonizeNewlines(va... | java |
protected String harmonizeNewlines(final String original) {
final String toReturn = original.trim().replaceAll("[\r\n]+", "\n");
return toReturn.endsWith("\n") ? toReturn : toReturn + "\n";
} | java |
@SuppressWarnings("all")
protected void warnAboutIncorrectPluginConfiguration(final String propertyName, final String description) {
final StringBuilder builder = new StringBuilder();
builder.append("\n+=================== [Incorrect Plugin Configuration Detected]\n");
builder.append("|\n")... | java |
protected final File getStaleFile() {
final String staleFileName = "."
+ (getExecution() == null ? "nonExecutionJaxb" : getExecution().getExecutionId())
+ "-" + getStaleFileName();
return new File(staleFileDirectory, staleFileName);
} | java |
protected void logSystemPropertiesAndBasedir() {
if (getLog().isDebugEnabled()) {
final StringBuilder builder = new StringBuilder();
builder.append("\n+=================== [System properties]\n");
builder.append("|\n");
// Sort the system properties
... | java |
public static LocaleFacet createFor(final String localeString, final Log log) throws MojoExecutionException {
// Check sanity
Validate.notNull(log, "log");
Validate.notEmpty(localeString, "localeString");
final StringTokenizer tok = new StringTokenizer(localeString, ",", false);
... | java |
public static Level getJavaUtilLoggingLevelFor(final Log mavenLog) {
// Check sanity
Validate.notNull(mavenLog, "mavenLog");
Level toReturn = Level.SEVERE;
if (mavenLog.isDebugEnabled()) {
toReturn = Level.FINER;
} else if (mavenLog.isInfoEnabled()) {
t... | java |
public static Filter getLoggingFilter(final String... requiredPrefixes) {
// Check sanity
Validate.notNull(requiredPrefixes, "requiredPrefixes");
// All done.
return new Filter() {
// Internal state
private List<String> requiredPrefs = Arrays.asList(requiredPre... | java |
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).isEmpt... | java |
public static String getElementTagName(final Node aNode) {
if (aNode != null && aNode.getNodeType() == Node.ELEMENT_NODE) {
final Element theElement = (Element) aNode;
return theElement.getTagName();
}
// The Node was not an Element.
return null;
} | java |
public static String getXPathFor(final Node aNode) {
List<String> nodeNameList = new ArrayList<String>();
for (Node current = aNode; current != null; current = current.getParentNode()) {
final String currentNodeName = current.getNodeName();
final String nameAttribute = DomHelp... | java |
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... | java |
public static MethodLocation getMethodLocation(final Node aNode, final Set<MethodLocation> methodLocations) {
MethodLocation toReturn = null;
if (aNode != null && CLASS_FIELD_METHOD_ELEMENT_NAMES.contains(aNode.getLocalName().toLowerCase())) {
final MethodLocation validLocation = getField... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.