@Test public void testIsValidPropertyAlias() { assertTrue(Name.isValidPropertyName("a")); assertTrue(Name.isValidPropertyName("-a")); assertTrue(Name.isValidPropertyName("_a.a_")); assertTrue(Name.isValidPropertyName("a-.-a")); assertTrue(Name.isValidPropertyName("a-.-a")); assertFalse(Name.isValidPropertyName(null)); assertFalse(Name.isValidPropertyName("")); assertFalse(Name.isValidPropertyName("\t")); assertFalse(Name.isValidPropertyName(" ")); assertFalse(Name.isValidPropertyName(" surroundedBySpace ")); assertFalse(Name.isValidPropertyName("contains space")); assertFalse(Name.isValidPropertyName(".startsWithDot")); assertFalse(Name.isValidPropertyName("endsWithDot.")); assertFalse(Name.isValidPropertyName("no=equals")); assertFalse(Name.isValidPropertyName("no?question")); assertFalse(Name.isValidPropertyName("no/forward/slash")); }
public static boolean isValidPropertyName(String name) { if (name == null || name.length() == 0) { return false; } if (name.startsWith(".") || name.endsWith(".")) { return false; } for (char c : ILLEGAL_PROPERTY_NAME_CHARS.toCharArray()) { if (name.indexOf(c) > -1) { return false; } } return true; }
Name { public static boolean isValidPropertyName(String name) { if (name == null || name.length() == 0) { return false; } if (name.startsWith(".") || name.endsWith(".")) { return false; } for (char c : ILLEGAL_PROPERTY_NAME_CHARS.toCharArray()) { if (name.indexOf(c) > -1) { return false; } } return true; } }
Name { public static boolean isValidPropertyName(String name) { if (name == null || name.length() == 0) { return false; } if (name.startsWith(".") || name.endsWith(".")) { return false; } for (char c : ILLEGAL_PROPERTY_NAME_CHARS.toCharArray()) { if (name.indexOf(c) > -1) { return false; } } return true; } Name(String name, boolean in, boolean out); }
Name { public static boolean isValidPropertyName(String name) { if (name == null || name.length() == 0) { return false; } if (name.startsWith(".") || name.endsWith(".")) { return false; } for (char c : ILLEGAL_PROPERTY_NAME_CHARS.toCharArray()) { if (name.indexOf(c) > -1) { return false; } } return true; } Name(String name, boolean in, boolean out); boolean isIn(); boolean isOut(); String getActualName(); static boolean isValidPropertyName(String name); }
Name { public static boolean isValidPropertyName(String name) { if (name == null || name.length() == 0) { return false; } if (name.startsWith(".") || name.endsWith(".")) { return false; } for (char c : ILLEGAL_PROPERTY_NAME_CHARS.toCharArray()) { if (name.indexOf(c) > -1) { return false; } } return true; } Name(String name, boolean in, boolean out); boolean isIn(); boolean isOut(); String getActualName(); static boolean isValidPropertyName(String name); static String ILLEGAL_PROPERTY_NAME_CHARS; }