org.gradle.api.Named Java Examples
The following examples show how to use
org.gradle.api.Named.
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: AbstractTargetedProjectNativeComponent.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private <T extends Named> Set<T> chooseElements(Class<T> type, Set<? extends T> candidates, final Set<String> names) { if (names.isEmpty()) { return new LinkedHashSet<T>(candidates); } Set<String> unusedNames = new HashSet<String>(names); Set<T> chosen = new LinkedHashSet<T>(); for (T candidate : candidates) { if (unusedNames.remove(candidate.getName())) { chosen.add(candidate); } } if (!unusedNames.isEmpty()) { throw new InvalidUserDataException(String.format("Invalid %s: '%s'", type.getSimpleName(), unusedNames.iterator().next())); } return chosen; }
Example #2
Source File: AbstractTargetedNativeComponentSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
protected <T extends Named> Set<T> chooseElements(Class<T> type, Set<? extends T> candidates, Set<String> names) { if (names.isEmpty()) { return new LinkedHashSet<T>(candidates); } Set<String> unusedNames = new HashSet<String>(names); Set<T> chosen = new LinkedHashSet<T>(); for (T candidate : candidates) { if (unusedNames.remove(candidate.getName())) { chosen.add(candidate); } } if (!unusedNames.isEmpty()) { throw new InvalidUserDataException(String.format("Invalid %s: '%s'", type.getSimpleName(), unusedNames.iterator().next())); } return chosen; }
Example #3
Source File: AbstractTargetedNativeComponentSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
protected <T extends Named> Set<T> chooseElements(Class<T> type, Set<? extends T> candidates, Set<String> names) { if (names.isEmpty()) { return new LinkedHashSet<T>(candidates); } Set<String> unusedNames = new HashSet<String>(names); Set<T> chosen = new LinkedHashSet<T>(); for (T candidate : candidates) { if (unusedNames.remove(candidate.getName())) { chosen.add(candidate); } } if (!unusedNames.isEmpty()) { throw new InvalidUserDataException(String.format("Invalid %s: '%s'", type.getSimpleName(), unusedNames.iterator().next())); } return chosen; }
Example #4
Source File: AbstractTargetedProjectNativeComponent.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private <T extends Named> Set<T> chooseElements(Class<T> type, Set<? extends T> candidates, final Set<String> names) { if (names.isEmpty()) { return new LinkedHashSet<T>(candidates); } Set<String> unusedNames = new HashSet<String>(names); Set<T> chosen = new LinkedHashSet<T>(); for (T candidate : candidates) { if (unusedNames.remove(candidate.getName())) { chosen.add(candidate); } } if (!unusedNames.isEmpty()) { throw new InvalidUserDataException(String.format("Invalid %s: '%s'", type.getSimpleName(), unusedNames.iterator().next())); } return chosen; }
Example #5
Source File: ProductFlavorCombo.java From javaide with GNU General Public License v3.0 | 5 votes |
private static <S extends DimensionAware & Named> void createProductFlavorCombinations( List<ProductFlavorCombo<S>> flavorGroups, List<S> group, int index, List<String> flavorDimensionList, ListMultimap<String, S> map) { if (index == flavorDimensionList.size()) { flavorGroups.add(new ProductFlavorCombo<S>(Iterables.filter(group, Predicates.notNull()))); return; } // fill the array at the current index. // get the dimension name that matches the index we are filling. String dimension = flavorDimensionList.get(index); // from our map, get all the possible flavors in that dimension. List<S> flavorList = map.get(dimension); // loop on all the flavors to add them to the current index and recursively fill the next // indices. if (flavorList.isEmpty()) { throw new RuntimeException(String.format( "No flavor is associated with flavor dimension '%1$s'.", dimension)); } else { for (S flavor : flavorList) { group.add(flavor); createProductFlavorCombinations( flavorGroups, group, index + 1, flavorDimensionList, map); group.remove(group.size() - 1); } } }
Example #6
Source File: DefaultNamedDomainObjectSet.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultNamedDomainObjectSet(Class<? extends T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #7
Source File: WrapUtil.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Wraps the given items in a named domain object set. */ public static <T extends Named> NamedDomainObjectSet<T> toNamedDomainObjectSet(Class<T> type, T... items) { DefaultNamedDomainObjectSet<T> domainObjectSet = new DefaultNamedDomainObjectSet<T>(type, new DirectInstantiator()); CollectionUtils.addAll(domainObjectSet, items); return domainObjectSet; }
Example #8
Source File: DefaultNamedDomainObjectSet.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultNamedDomainObjectSet(Class<? extends T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #9
Source File: NativeComponentSpecInitializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private <T extends Named> BinaryNamingSchemeBuilder maybeAddDimension(BinaryNamingSchemeBuilder builder, T variation, Collection<T> variations) { if (variations.size() > 1) { builder = builder.withVariantDimension(variation.getName()); } return builder; }
Example #10
Source File: DefaultNamedDomainObjectSet.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultNamedDomainObjectSet(Class<? extends T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #11
Source File: WrapUtil.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Wraps the given items in a named domain object set. */ public static <T extends Named> NamedDomainObjectSet<T> toNamedDomainObjectSet(Class<T> type, T... items) { DefaultNamedDomainObjectSet<T> domainObjectSet = new DefaultNamedDomainObjectSet<T>(type, new DirectInstantiator()); CollectionUtils.addAll(domainObjectSet, items); return domainObjectSet; }
Example #12
Source File: DefaultNamedDomainObjectSet.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultNamedDomainObjectSet(Class<? extends T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #13
Source File: NativeComponentSpecInitializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private <T extends Named> BinaryNamingSchemeBuilder maybeAddDimension(BinaryNamingSchemeBuilder builder, T variation, Collection<T> variations) { if (variations.size() > 1) { builder = builder.withVariantDimension(variation.getName()); } return builder; }
Example #14
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example #15
Source File: Transformers.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns a transformer that names {@link Named} objects. * * Nulls are returned as null. * * @return The naming transformer. */ public static Transformer<String, Named> name() { return name(new Named.Namer()); }
Example #16
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factoryClosure The closure responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, final Closure factoryClosure) { this(type, instantiator, Named.Namer.forType(type), factoryClosure); }
Example #17
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example #18
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates reflectively, expecting a 1 arg constructor taking the name.<p> * * <p>The type must implement the {@link Named} interface as a {@link Namer} will be created based on this type.</p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #19
Source File: Transformers.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns a transformer that names {@link Named} objects. * * Nulls are returned as null. * * @return The naming transformer. */ public static Transformer<String, Named> name() { return name(new Named.Namer()); }
Example #20
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates reflectively, expecting a 1 arg constructor taking the name.<p> * * <p>The type must implement the {@link Named} interface as a {@link Namer} will be created based on this type.</p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #21
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example #22
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factoryClosure The closure responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, final Closure factoryClosure) { this(type, instantiator, Named.Namer.forType(type), factoryClosure); }
Example #23
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates reflectively, expecting a 1 arg constructor taking the name.<p> * * <p>The type must implement the {@link Named} interface as a {@link Namer} will be created based on this type.</p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #24
Source File: FactoryNamedDomainObjectContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates reflectively, expecting a 1 arg constructor taking the name.<p> * * <p>The type must implement the {@link Named} interface as a {@link Namer} will be created based on this type.</p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator) { this(type, instantiator, Named.Namer.forType(type)); }
Example #25
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factoryClosure The closure responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, final Closure factoryClosure) { this(type, instantiator, Named.Namer.forType(type), factoryClosure); }
Example #26
Source File: Transformers.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns a transformer that names {@link Named} objects. * * Nulls are returned as null. * * @return The naming transformer. */ public static Transformer<String, Named> name() { return name(new Named.Namer()); }
Example #27
Source File: Transformers.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * Returns a transformer that names {@link Named} objects. * * Nulls are returned as null. * * @return The naming transformer. */ public static Transformer<String, Named> name() { return name(new Named.Namer()); }
Example #28
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factoryClosure The closure responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, final Closure factoryClosure) { this(type, instantiator, Named.Namer.forType(type), factoryClosure); }
Example #29
Source File: FactoryNamedDomainObjectContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }