org.gradle.api.internal.ConventionTask Java Examples

The following examples show how to use org.gradle.api.internal.ConventionTask. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationProcessingTaskFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    }
}
 
Example #2
Source File: AnnotationProcessingTaskFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    }
}
 
Example #3
Source File: ConventionMappingHelper.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static void map(@NonNull Task task, @NonNull String key, @NonNull Callable<?> value) {
    if (task instanceof ConventionTask) {
        ((ConventionTask) task).getConventionMapping().map(key, value);
    } else if (task instanceof GroovyObject) {
        ConventionMapping conventionMapping =
                (ConventionMapping) ((GroovyObject) task).getProperty("conventionMapping");
        conventionMapping.map(key, value);
    } else {
        throw new IllegalArgumentException(
                "Don't know how to apply convention mapping to task of type " + task.getClass().getName());
    }
}
 
Example #4
Source File: AnnotationProcessingTaskFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    }
}
 
Example #5
Source File: AnnotationProcessingTaskFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
        }
    }
}