public class FlavorDomain<T> extends Object
Constructor and Description |
---|
FlavorDomain(String name,
com.google.common.collect.ImmutableMap<Flavor,T> translation) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Flavor flavor) |
boolean |
containsAnyOf(FlavorSet flavors) |
boolean |
containsAnyOf(Set<Flavor> flavors) |
<U extends FlavorConvertible> |
convert(String name,
java.util.function.Function<? super T,U> mapper)
Provides a convenience for converting from one domain to another.
|
static <E extends Enum<E> & FlavorConvertible> |
from(String name,
Class<E> cls)
Create a FlavorDomain from FlavorConverbile Enum.
|
static <T extends FlavorConvertible> |
from(String name,
Iterable<T> objects)
Create a FlavorDomain from FlavorConvertible objects.
|
Optional<Flavor> |
getFlavor(BuildTarget buildTarget) |
Optional<Flavor> |
getFlavor(FlavorSet flavorSet) |
Optional<Flavor> |
getFlavor(Set<Flavor> flavors) |
Optional<Map.Entry<Flavor,T>> |
getFlavorAndValue(BuildTarget buildTarget) |
Optional<Map.Entry<Flavor,T>> |
getFlavorAndValue(FlavorSet flavors) |
Optional<Map.Entry<Flavor,T>> |
getFlavorAndValue(Set<Flavor> flavors) |
com.google.common.collect.ImmutableSet<Flavor> |
getFlavors() |
String |
getName() |
T |
getRequiredValue(BuildTarget buildTarget) |
Optional<T> |
getValue(BuildTarget buildTarget) |
T |
getValue(Flavor flavor) |
Optional<T> |
getValue(FlavorSet flavors) |
Optional<T> |
getValue(Set<Flavor> flavors) |
com.google.common.collect.ImmutableCollection<T> |
getValues() |
com.google.common.collect.ImmutableList<T> |
getValues(BuildTarget buildTarget) |
<U> FlavorDomain<U> |
map(java.util.function.Function<? super T,U> mapper)
Provides a convenience function to map the values of the domain (retaining the current name).
|
<U> FlavorDomain<U> |
map(String name,
java.util.function.Function<? super T,U> mapper)
Provides a convenience function to map the values of the domain.
|
static <T extends FlavorConvertible> |
of(String name,
T... objects)
Create a FlavorDomain from array/varargs of FlavorConvertible objects.
|
public String getName()
public com.google.common.collect.ImmutableSet<Flavor> getFlavors()
public com.google.common.collect.ImmutableCollection<T> getValues()
public boolean containsAnyOf(FlavorSet flavors)
public <U> FlavorDomain<U> map(java.util.function.Function<? super T,U> mapper)
public <U> FlavorDomain<U> map(String name, java.util.function.Function<? super T,U> mapper)
public <U extends FlavorConvertible> FlavorDomain<U> convert(String name, java.util.function.Function<? super T,U> mapper)
FlavorConvertible
.public boolean contains(Flavor flavor)
public Optional<Flavor> getFlavor(BuildTarget buildTarget)
public Optional<Map.Entry<Flavor,T>> getFlavorAndValue(BuildTarget buildTarget)
public Optional<T> getValue(BuildTarget buildTarget)
public com.google.common.collect.ImmutableList<T> getValues(BuildTarget buildTarget)
public T getRequiredValue(BuildTarget buildTarget)
public static <T extends FlavorConvertible> FlavorDomain<T> from(String name, Iterable<T> objects)
@SafeVarargs public static <T extends FlavorConvertible> FlavorDomain<T> of(String name, T... objects)
public static <E extends Enum<E> & FlavorConvertible> FlavorDomain<E> from(String name, Class<E> cls)