CPD Results

The following document contains the results of PMD's CPD 4.1.

Duplications

File Line
org\apache\commons\clazz\reflect\common\ReflectedListPropertyIntrospectorSupport.java 160
org\apache\commons\clazz\reflect\extended\ReflectedMappedPropertyIntrospector.java 284
        property.setKeySetMethod(parseResultsMapped.getKeySetMethod());
        return property;
    }

    /**
     * Parser for the <code>getFooMap()</code> method:
     * <ul>
     *  <li>Return type not void</li>
     *  <li>Name starts with "get" followed by capitalized property name</li>
     *  <li>No parameters</li>
     * </ul>
     * 
     * We don't check if the parameter is a Map here. If it is not,
     * we want to recognize the method and them mark the corresponding
     * property as NotAProperty.
     */
    public static class ReadAccessorMethodParser extends AccessorMethodParser {
        protected boolean testReturnType(Class returnType) {
            return !returnType.equals(Void.TYPE);
        }
        protected String requiredPrefix() {
            return "get";
        }
        protected int requiredParameterCount() {
            return 0;
        }
        protected Class getValueType(Method method) {
            return method.getReturnType();
        }
    }
    
    /**
     * Parser for the <code>setFooMap(Map)</code> method:
     * <ul>
     *  <li>Return type void</li>
     *  <li>Name starts with "set" followed by capitalized property name</li>
     *  <li>One parameter</li>
     * </ul>
     * 
     * We don't check if the parameter is a Map here. If it is not,
     * we want to recognize the method and them mark the corresponding
     * property as NotAProperty.
     */            
    public static class WriteAccessorMethodParser extends AccessorMethodParser {
        protected boolean testReturnType(Class returnType) {
            return returnType.equals(Void.TYPE);
        }
        protected int requiredParameterCount() {
            return 1;
        }
        protected String requiredPrefix() {
            return "set";
        }
        protected Class getValueType(Method method) {
            return method.getParameterTypes()[0];
        }
    }
    
    /**
     * Parser for the <code>getFoo(key)</code> method:
     * <ul>
     *  <li>Return type not void</li>
     *  <li>Name starts with "get" followed by capitalized singular
     *      form of the property name</li>
     *  <li>One parameter</li>
     * </ul>
     */            
    public static class GetAccessorMethodParser extends AccessorMethodParser {
        protected boolean testReturnType(Class returnType) {
            return !returnType.equals(Void.TYPE);
        }
        protected String requiredPrefix() {
            return "get";
        }
        protected int requiredParameterCount() {
            return 1;
        }
        protected Class getValueType(Method method) {

File Line
org\apache\commons\clazz\reflect\extended\ExtendedReflectedListPropertyIntrospector.java 78
org\apache\commons\clazz\reflect\standard\StandardReflectedListPropertyIntrospector.java 47
            results = getReadAccessMethodParser().parse(method);
            if (results != null) {
                parseResults =
                    getParseResults(
                        clazz,
                        parseResultMap,
                        results.getPropertyName());
                parseResults.setReadMethodParseResults(results);
                continue;
            }

            results = getWriteAccessMethodParser().parse(method);
            if (results != null) {
                parseResults =
                    getParseResults(
                        clazz,
                        parseResultMap,
                        results.getPropertyName());
                parseResults.setWriteMethodParseResults(results);
                continue;
            }

            results = getGetAccessMethodParser().parse(method);
            if (results != null) {
                parseResults =
                    getParseResults(
                        clazz,
                        parseResultMapSingular,
                        results.getPropertyName());
                parseResults.setGetMethodParseResults(results);
                continue;
            }
            
            results = getSetAccessMethodParser().parse(method);
            if (results != null) {
                parseResults =
                    getParseResults(
                        clazz,
                        parseResultMapSingular,
                        results.getPropertyName());
                parseResults.setSetMethodParseResults(results);
                continue;
            }            

File Line
org\apache\commons\clazz\reflect\common\ReflectedListProperty.java 186
org\apache\commons\clazz\reflect\extended\ReflectedMappedProperty.java 160
            buffer.append("] ");
        }
        if (getContentType() != null) {
            buffer.append("[content: ");
            buffer.append(getContentType().getName());
            buffer.append("] ");
        }
        buffer.append(getName());
        if (getReadMethod() != null) {
            buffer.append("\n   [read method]      ");
            buffer.append(getReadMethod());            
        }
        if (getWriteMethod() != null) {
            buffer.append("\n   [write method]     ");
            buffer.append(getWriteMethod());            
        }
        if (getGetMethod() != null) {
            buffer.append("\n   [get method]       ");
            buffer.append(getGetMethod());            
        }
        if (getPutMethod() != null) {

File Line
org\apache\commons\clazz\bean\BeanClazzInstanceFactory.java 61
org\apache\commons\clazz\bean\BeanClazzOperation.java 74
    }

    /**
     * @see ClazzOperation#getName()
     */
    public String getName() {
        return name;
    }

    /**
     * @see ClazzOperation#getParameterClazzes()
     */
    public Clazz[] getParameterClazzes() {
        if (parameterClazzes == null) {
            parameterClazzes = new Clazz[parameterClazzNames.length];
            ClazzLoader loader = getDeclaringClazz().getClazzLoader();
            for (int i = 0; i < parameterClazzes.length; i++) {
                parameterClazzes[i] =
                    loader.getClazzForName(parameterClazzNames[i]);
                if (parameterClazzes[i] == null) {
                    throw new BeanClazzConfigurationException(
                        "Invalid argument type: "
                            + parameterClazzNames[i]
                            + ". Clazz not found.");
                }
            }
        }

        return parameterClazzes;
    }

    /**
     * @see ClazzOperation#getReturnClazz()
     */
    public Clazz getReturnClazz() {