public void setFullNamePattern(final String pattern) throws ParseException { int index = pattern.lastIndexOf('.'); String classPattern = null; // Aw-112 support for "method(..)" and "com..*(..)" if (index > 0) { classPattern = pattern.substring(0, index); if (classPattern.endsWith(".")) { classPattern += ".*"; } } else { // unspecified classPattern like "method(..)" classPattern = "*..*"; } if (classPattern.endsWith("+")) { classPattern = classPattern.substring(0, classPattern.length() - 1); m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.MATCH_ON_ALL_METHODS); } else if (classPattern.endsWith("#")) { classPattern = classPattern.substring(0, classPattern.length() - 1); m_declaringTypePattern = Pattern.compileTypePattern( classPattern, SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY); } else { m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.NOT_HIERARCHICAL); } String methodNamePattern = pattern.substring(index + 1, pattern.length()); m_methodNamePattern = Pattern.compileNamePattern(methodNamePattern); if ("new".equals(methodNamePattern)) { throw new ParseException( "Using a constructor pattern with an explicit return type is not allowed"); } }
public void setReturnTypePattern(String pattern) { if (pattern.endsWith("+")) { pattern = pattern.substring(0, pattern.length() - 1); m_returnTypePattern = Pattern.compileTypePattern(pattern, SubtypePatternType.MATCH_ON_ALL_METHODS); } else if (pattern.endsWith("#")) { pattern = pattern.substring(0, pattern.length() - 1); m_returnTypePattern = Pattern.compileTypePattern(pattern, SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY); } else { m_returnTypePattern = Pattern.compileTypePattern(pattern, SubtypePatternType.NOT_HIERARCHICAL); } }