org.snapscript.core.NameChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.core;
public class NameChecker {
private final boolean strict;
public NameChecker(boolean strict) {
this.strict = strict;
}
public boolean isEntity(String name) {
int index = name.lastIndexOf(".");
char first = name.charAt(index == -1 ? 0 : index + 1);
if(strict) {
return Character.isUpperCase(first) && Character.isAlphabetic(first);
}
return Character.isUpperCase(first);
}
}