org.gradle.api.internal.tasks.options.OptionReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-test-kit Show documentation
Show all versions of gradle-test-kit Show documentation
Gradle 6.2.1 API redistribution.
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.tasks.options;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import org.gradle.api.tasks.options.Option;
import org.gradle.api.tasks.options.OptionValues;
import org.gradle.internal.reflect.JavaMethod;
import org.gradle.util.internal.CollectionUtils;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
public class OptionReader {
private final ListMultimap, OptionElement> cachedOptionElements = ArrayListMultimap.create();
private final Map> cachedOptionValueMethods = new HashMap>();
private final OptionValueNotationParserFactory optionValueNotationParserFactory = new OptionValueNotationParserFactory();
public Map getOptions(Object target) {
final Class> targetClass = target.getClass();
Map options = new HashMap();
if (!cachedOptionElements.containsKey(targetClass)) {
loadClassDescriptorInCache(target);
}
for (OptionElement optionElement : cachedOptionElements.get(targetClass)) {
JavaMethod
© 2015 - 2025 Weber Informatics LLC | Privacy Policy