Java 类org.gradle.api.internal.ConventionTask 实例源码

项目:Pushjet-Android    文件:AnnotationProcessingTaskFactory.java   
public void attachActions(PropertyInfo parent, Class<?> type) {
    Class<?> superclass = type.getSuperclass();
    if (!(superclass == null
            // Avoid reflecting on classes we know we don't need to look at
            || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class)
            || superclass.equals(AbstractTask.class) || superclass.equals(Object.class)
    )) {
        attachActions(parent, superclass);
    }

    for (Method method : type.getDeclaredMethods()) {
        if (!isGetter(method)) {
            continue;
        }

        String name = method.getName();
        int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'.
        String fieldName = StringUtils.uncapitalize(name.substring(prefixLength));
        String propertyName = fieldName;
        if (parent != null) {
            propertyName = parent.getName() + '.' + propertyName;
        }
        PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method);

        attachValidationActions(propertyInfo, fieldName);

        if (propertyInfo.required) {
            properties.add(propertyInfo);
        }
    }
}
项目:Pushjet-Android    文件:AnnotationProcessingTaskFactory.java   
public void attachActions(PropertyInfo parent, Class<?> type) {
    Class<?> superclass = type.getSuperclass();
    if (!(superclass == null
            // Avoid reflecting on classes we know we don't need to look at
            || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class)
            || superclass.equals(AbstractTask.class) || superclass.equals(Object.class)
    )) {
        attachActions(parent, superclass);
    }

    for (Method method : type.getDeclaredMethods()) {
        if (!isGetter(method)) {
            continue;
        }

        String name = method.getName();
        int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'.
        String fieldName = StringUtils.uncapitalize(name.substring(prefixLength));
        String propertyName = fieldName;
        if (parent != null) {
            propertyName = parent.getName() + '.' + propertyName;
        }
        PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method);

        attachValidationActions(propertyInfo, fieldName);

        if (propertyInfo.required) {
            properties.add(propertyInfo);
        }
    }
}