private String findComplexKey(String path) { String result = null; for (String key : mappings.keySet()) { if (isComplexKey(key) && match(key, path, false)) { if (result == null || key.length() > result.length()) { // longest key wins result = key; } } } return result; }
private String findComplexKey(String path) { String result = null; for (String key : mappings.keySet()) { if (isComplexKey(key) && match(key, path, false)) { if (result == null || key.length() > result.length()) { // longest key wins result = key; } } } return result; }
/** * Wheter the first pattern is more specific than the second one. * Exact patterns are more specific than complex patterns and * complex patterns are more specific than default patterns. * @param exclusionPattern pattern which must be more or equally specific to return <code>true</code> * @param decoratorPattern pattern which must be less specific to return <code>true</code> * @return <code>true</code> if the first pattern is more specific than the second one */ public static boolean isMoreSpecific(String exclusionPattern, String decoratorPattern) { if(isDefaultKey(decoratorPattern)) { return true; } if(isComplexKey(decoratorPattern)){ if(isComplexKey(exclusionPattern)) { return exclusionPattern.length() >= decoratorPattern.length(); } return !isDefaultKey(decoratorPattern); } return !isComplexKey(exclusionPattern) && !isDefaultKey(exclusionPattern); } }
/** * Wheter the first pattern is more specific than the second one. * Exact patterns are more specific than complex patterns and * complex patterns are more specific than default patterns. * @param exclusionPattern pattern which must be more or equally specific to return <code>true</code> * @param decoratorPattern pattern which must be less specific to return <code>true</code> * @return <code>true</code> if the first pattern is more specific than the second one */ public static boolean isMoreSpecific(String exclusionPattern, String decoratorPattern) { if(isDefaultKey(decoratorPattern)) { return true; } if(isComplexKey(decoratorPattern)){ if(isComplexKey(exclusionPattern)) { return exclusionPattern.length() >= decoratorPattern.length(); } return !isDefaultKey(decoratorPattern); } return !isComplexKey(exclusionPattern) && !isDefaultKey(exclusionPattern); } }