Package com.atlassian.bamboo.utils
Class BambooFunctions
- java.lang.Object
-
- com.atlassian.bamboo.utils.BambooFunctions
-
public class BambooFunctions extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static BiFunction<Long,Long,Long>
addLong()
static <F,T>
com.google.common.base.Function<F,T>constant(T result)
static <A,B>
com.google.common.base.Function<Pair<A,B>,A>firstOfPair()
static com.google.common.base.Function<List<Long>,Long>
foldListOfLong()
static com.google.common.base.Function<ArtifactLink,Artifact>
getArtifactFromArtifactLink()
RetrievesArtifact
from anArtifactLink
.static com.google.common.base.Function<Artifact,String>
getArtifactName()
static com.google.common.base.Function<BambooIdProvider,Long>
getBambooObjectId()
static com.google.common.base.Function<Enum,String>
getEnumName()
Deprecated.use method reference toEnum.name()
static com.google.common.base.Function<ResultKeyProvider,ResultKey>
getResultKey()
Extract ResultKey from ResultKeyProvider JDK8: replace with lambdastatic <E extends Exception,T>
com.google.common.base.Function<Result<E,T>,T>getResultOrNull()
static <T> com.google.common.base.Function<Integer,T>
itemFromList(List<T> items)
static <E extends Enum<E>>
BinaryOperator<E>lesserOf()
static <K,V,R>
Function<? super Map.Entry<K,V>,R>liftToEntryFunction(BiFunction<K,V,R> biFunction)
Adapts the supplied biFunction so that it can be used to process map entriesstatic BiFunction<Long,Long,Long>
max()
static <E extends Exception,T>
com.google.common.base.Predicate<Result<E,T>>resultIsException()
static <E extends Exception,T>
com.google.common.base.Predicate<Result<E,T>>resultIsResult()
static com.google.common.base.Function<String,String>
translate(@NotNull com.opensymphony.xwork2.TextProvider textProvider)
Function which translates i18n keys to text using givenTextProvider
.
-
-
-
Method Detail
-
constant
public static <F,T> com.google.common.base.Function<F,T> constant(@Nullable T result)
-
itemFromList
public static <T> com.google.common.base.Function<Integer,T> itemFromList(List<T> items)
-
getBambooObjectId
public static com.google.common.base.Function<BambooIdProvider,Long> getBambooObjectId()
-
addLong
public static BiFunction<Long,Long,Long> addLong()
-
max
public static BiFunction<Long,Long,Long> max()
-
getResultOrNull
public static <E extends Exception,T> com.google.common.base.Function<Result<E,T>,T> getResultOrNull()
-
resultIsException
public static <E extends Exception,T> com.google.common.base.Predicate<Result<E,T>> resultIsException()
-
resultIsResult
public static <E extends Exception,T> com.google.common.base.Predicate<Result<E,T>> resultIsResult()
-
getEnumName
@Deprecated public static com.google.common.base.Function<Enum,String> getEnumName()
Deprecated.use method reference toEnum.name()
-
lesserOf
public static <E extends Enum<E>> BinaryOperator<E> lesserOf()
-
translate
public static com.google.common.base.Function<String,String> translate(@NotNull @NotNull com.opensymphony.xwork2.TextProvider textProvider)
Function which translates i18n keys to text using givenTextProvider
. The function usesTextProvider.getText(String)
method, without any additional arguments.- Parameters:
textProvider
- text provider- Returns:
- translation function
-
getResultKey
public static com.google.common.base.Function<ResultKeyProvider,ResultKey> getResultKey()
Extract ResultKey from ResultKeyProvider JDK8: replace with lambda
-
getArtifactFromArtifactLink
public static com.google.common.base.Function<ArtifactLink,Artifact> getArtifactFromArtifactLink()
RetrievesArtifact
from anArtifactLink
.
-
firstOfPair
public static <A,B> com.google.common.base.Function<Pair<A,B>,A> firstOfPair()
-
liftToEntryFunction
public static <K,V,R> Function<? super Map.Entry<K,V>,R> liftToEntryFunction(BiFunction<K,V,R> biFunction)
Adapts the supplied biFunction so that it can be used to process map entries
-
-