/** * 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); } }