Search in sources :

Example 1 with Option

use of org.gradle.api.tasks.options.Option in project gradle by gradle.

the class OptionReader method getFieldAnnotations.

private List<OptionElement> getFieldAnnotations(Class<?> type) {
    List<OptionElement> fieldOptionElements = new ArrayList<OptionElement>();
    for (Field field : type.getDeclaredFields()) {
        Option option = findOption(field, Option.class);
        if (option != null) {
            fieldOptionElements.add(FieldOptionElement.create(option, field, optionValueNotationParserFactory));
        } else {
            org.gradle.api.internal.tasks.options.Option internalOption = findOption(field, org.gradle.api.internal.tasks.options.Option.class);
            if (internalOption != null) {
                SingleMessageLogger.nagUserOfDeprecated("org.gradle.api.internal.tasks.options.Option", "Use org.gradle.api.tasks.options.Option instead");
                fieldOptionElements.add(FieldOptionElement.create(internalOption, field, optionValueNotationParserFactory));
            }
        }
    }
    return fieldOptionElements;
}
Also used : Field(java.lang.reflect.Field) ArrayList(java.util.ArrayList) Option(org.gradle.api.tasks.options.Option)

Example 2 with Option

use of org.gradle.api.tasks.options.Option in project gradle by gradle.

the class OptionReader method getMethodAnnotations.

private List<OptionElementAndSignature> getMethodAnnotations(Class<?> type) {
    List<OptionElementAndSignature> methodOptionElements = new ArrayList<>();
    for (Method method : type.getDeclaredMethods()) {
        Option option = findOption(method);
        if (option != null) {
            OptionElement methodOptionDescriptor = MethodOptionElement.create(option, method, optionValueNotationParserFactory);
            methodOptionElements.add(new OptionElementAndSignature(methodOptionDescriptor, MethodSignature.from(method)));
        }
    }
    return methodOptionElements;
}
Also used : ArrayList(java.util.ArrayList) Option(org.gradle.api.tasks.options.Option) JavaMethod(org.gradle.internal.reflect.JavaMethod) Method(java.lang.reflect.Method)

Example 3 with Option

use of org.gradle.api.tasks.options.Option in project MyLuaApp-Build-Core by dingyi222666.

the class OptionReader method getMethodAnnotations.

private List<OptionElement> getMethodAnnotations(Class<?> type) {
    List<OptionElement> methodOptionElements = new ArrayList<OptionElement>();
    for (Method method : type.getDeclaredMethods()) {
        Option option = findOption(method);
        if (option != null) {
            OptionElement methodOptionDescriptor = MethodOptionElement.create(option, method, optionValueNotationParserFactory);
            methodOptionElements.add(methodOptionDescriptor);
        }
    }
    return methodOptionElements;
}
Also used : ArrayList(java.util.ArrayList) Option(org.gradle.api.tasks.options.Option) JavaMethod(org.gradle.internal.reflect.JavaMethod) Method(java.lang.reflect.Method)

Aggregations

ArrayList (java.util.ArrayList)3 Option (org.gradle.api.tasks.options.Option)3 Method (java.lang.reflect.Method)2 JavaMethod (org.gradle.internal.reflect.JavaMethod)2 Field (java.lang.reflect.Field)1