|
|
@ -355,7 +355,7 @@ public final class ConfigurationPropertyName
|
|
|
|
if (obj == this) {
|
|
|
|
if (obj == this) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (obj == null || !obj.getClass().equals(getClass())) {
|
|
|
|
if (obj == null || obj.getClass() != getClass()) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ConfigurationPropertyName other = (ConfigurationPropertyName) obj;
|
|
|
|
ConfigurationPropertyName other = (ConfigurationPropertyName) obj;
|
|
|
@ -410,8 +410,11 @@ public final class ConfigurationPropertyName
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isIndexed(CharSequence element) {
|
|
|
|
private static boolean isIndexed(CharSequence element) {
|
|
|
|
int length = element.length();
|
|
|
|
int length = element.length();
|
|
|
|
return length > 2 && element.charAt(0) == '['
|
|
|
|
return charAt(element, 0) == '[' && charAt(element, length - 1) == ']';
|
|
|
|
&& element.charAt(length - 1) == ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static char charAt(CharSequence element, int index) {
|
|
|
|
|
|
|
|
return (index < element.length() ? element.charAt(index) : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -496,7 +499,7 @@ public final class ConfigurationPropertyName
|
|
|
|
if (name.length() == 0) {
|
|
|
|
if (name.length() == 0) {
|
|
|
|
return EMPTY;
|
|
|
|
return EMPTY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<CharSequence> elements = new ArrayList<>(10);
|
|
|
|
List<CharSequence> elements = new ArrayList<>();
|
|
|
|
process(name, separator, (elementValue, start, end, indexed) -> {
|
|
|
|
process(name, separator, (elementValue, start, end, indexed) -> {
|
|
|
|
elementValue = elementValueProcessor.apply(elementValue);
|
|
|
|
elementValue = elementValueProcessor.apply(elementValue);
|
|
|
|
if (!isIndexed(elementValue)) {
|
|
|
|
if (!isIndexed(elementValue)) {
|
|
|
@ -656,10 +659,16 @@ public final class ConfigurationPropertyName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean isValidElement(CharSequence elementValue) {
|
|
|
|
public static boolean isValidElement(CharSequence elementValue) {
|
|
|
|
return getInvalidChars(elementValue).isEmpty();
|
|
|
|
for (int i = 0; i < elementValue.length(); i++) {
|
|
|
|
|
|
|
|
char ch = elementValue.charAt(i);
|
|
|
|
|
|
|
|
if (!isValidChar(ch, i)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static List<Character> getInvalidChars(CharSequence elementValue) {
|
|
|
|
public static List<Character> getInvalidChars(CharSequence elementValue) {
|
|
|
|
List<Character> chars = new ArrayList<>();
|
|
|
|
List<Character> chars = new ArrayList<>();
|
|
|
|
for (int i = 0; i < elementValue.length(); i++) {
|
|
|
|
for (int i = 0; i < elementValue.length(); i++) {
|
|
|
|
char ch = elementValue.charAt(i);
|
|
|
|
char ch = elementValue.charAt(i);
|
|
|
@ -671,12 +680,15 @@ public final class ConfigurationPropertyName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean isValidChar(char ch, int index) {
|
|
|
|
public static boolean isValidChar(char ch, int index) {
|
|
|
|
boolean isAlpha = ch >= 'a' && ch <= 'z';
|
|
|
|
return isAlpha(ch) || (index != 0 && (isNumeric(ch) || ch == '-'));
|
|
|
|
boolean isNumeric = ch >= '0' && ch <= '9';
|
|
|
|
}
|
|
|
|
if (index == 0) {
|
|
|
|
|
|
|
|
return isAlpha;
|
|
|
|
private static boolean isAlpha(char ch) {
|
|
|
|
}
|
|
|
|
return ch >= 'a' && ch <= 'z';
|
|
|
|
return isAlpha || isNumeric || ch == '-';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isNumeric(char ch) {
|
|
|
|
|
|
|
|
return ch >= '0' && ch <= '9';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|