com.atlassian.bamboo.utils
Class Comparators

java.lang.Object
  extended by com.atlassian.bamboo.utils.Comparators

public class Comparators
extends java.lang.Object


Method Summary
static java.util.Comparator<java.lang.String> getApplicationBuildNumberComparator()
           
static com.google.common.collect.Ordering<ImmutablePlan> getBranchUpdatedDateOrdering()
          Comparator for sorting by enabled/disabled then updated then created dates of branches
static java.util.Comparator<ResultsSummary> getBuildCompletedDateComparator()
           
static com.google.common.collect.Ordering<ResultStatisticsProvider> getBuildDateOrdering()
           
static com.google.common.collect.Ordering<DescriptionProvider> getDescriptionProviderOrdering()
           
static java.util.Comparator<ElasticImageConfiguration> getElasticImageConfigurationNameComparator()
           
static com.google.common.collect.Ordering<ImmutableJob> getJobStagePlanNameCaseInsensitiveOrdering()
           
static java.util.Comparator<LabelCount> getLabelCountAlphabeticComparator()
           
static java.util.Comparator<LabelCount> getLabelCountRankComparator()
           
static com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering()
           
static com.google.common.collect.Ordering<NameProvider> getNameProviderCaseInsensitiveOrdering()
          Do not use this for plans unless you know the plans you are sorting are within the same parent (e.g.
static com.google.common.collect.Ordering<NameProvider> getNameProviderOrdering()
          Not that this order is case sensitive.
static com.google.common.collect.Ordering<ImmutablePlan> getPlanNameProviderCaseInsensitiveOrdering()
          This method will be slower than getTopLevelPlanNameProviderCaseInsensitiveOrdering() so consider using that instead.
static com.google.common.collect.Ordering<ResultsSummary> getPlanNameResultOrdering()
           
static com.google.common.collect.Ordering<PlanResultKey> getPlanResultKeyOrdering()
           
static com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNameAndNumberComparator()
           
static com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNumberOrdering()
           
static
<T extends ImmutableChain>
com.google.common.collect.Ordering<T>
getTopLevelPlanNameProviderCaseInsensitiveOrdering()
           
static com.google.common.collect.Ordering<VariableDefinitionContext> getVariableDefinitionContextOrdering()
           
static com.google.common.collect.Ordering<VariableDefinition> getVariableDefinitionOrdering()
           
static
<T> boolean
isGreater(T o1, T o2, java.util.Comparator<T> comparator)
           
static
<T> boolean
isGreaterOrEqual(T o1, T o2, java.util.Comparator<T> comparator)
           
static
<T> boolean
isLesser(T o1, T o2, java.util.Comparator<T> comparator)
           
static
<T> boolean
isLesserOrEqual(T o1, T o2, java.util.Comparator<T> comparator)
           
static
<T> java.util.Comparator<T>
stringPropertyCaseInsensitiveComparator(java.lang.Class<T> beanClass, java.lang.String propertyName)
           
static
<T> java.util.Comparator<T>
stringPropertyComparator(java.lang.Class<T> beanClass, java.lang.String propertyName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBuildCompletedDateComparator

@NotNull
public static java.util.Comparator<ResultsSummary> getBuildCompletedDateComparator()

getBuildDateOrdering

@NotNull
public static com.google.common.collect.Ordering<ResultStatisticsProvider> getBuildDateOrdering()

getBranchUpdatedDateOrdering

@NotNull
public static com.google.common.collect.Ordering<ImmutablePlan> getBranchUpdatedDateOrdering()
Comparator for sorting by enabled/disabled then updated then created dates of branches

Returns:

getDescriptionProviderOrdering

@NotNull
public static com.google.common.collect.Ordering<DescriptionProvider> getDescriptionProviderOrdering()

getElasticImageConfigurationNameComparator

@NotNull
public static java.util.Comparator<ElasticImageConfiguration> getElasticImageConfigurationNameComparator()

getLabelCountAlphabeticComparator

@NotNull
public static java.util.Comparator<LabelCount> getLabelCountAlphabeticComparator()

getLabelCountRankComparator

@NotNull
public static java.util.Comparator<LabelCount> getLabelCountRankComparator()

getNameProviderOrdering

@NotNull
public static com.google.common.collect.Ordering<NameProvider> getNameProviderOrdering()
Not that this order is case sensitive. If using for UI use getNameProviderCaseInsensitiveOrdering() instead

Returns:

getTopLevelPlanNameProviderCaseInsensitiveOrdering

@NotNull
public static <T extends ImmutableChain> com.google.common.collect.Ordering<T> getTopLevelPlanNameProviderCaseInsensitiveOrdering()

getPlanNameProviderCaseInsensitiveOrdering

@NotNull
public static com.google.common.collect.Ordering<ImmutablePlan> getPlanNameProviderCaseInsensitiveOrdering()
This method will be slower than getTopLevelPlanNameProviderCaseInsensitiveOrdering() so consider using that instead.

Returns:
Ordering object

getNameProviderCaseInsensitiveOrdering

@NotNull
public static com.google.common.collect.Ordering<NameProvider> getNameProviderCaseInsensitiveOrdering()
Do not use this for plans unless you know the plans you are sorting are within the same parent (e.g. same project, or same chain.) Use getTopLevelPlanNameProviderCaseInsensitiveOrdering() or getPlanNameProviderCaseInsensitiveOrdering() instead

Returns:

stringPropertyComparator

@NotNull
public static <T> java.util.Comparator<T> stringPropertyComparator(@NotNull
                                                                           java.lang.Class<T> beanClass,
                                                                           @NotNull
                                                                           java.lang.String propertyName)

stringPropertyCaseInsensitiveComparator

@NotNull
public static <T> java.util.Comparator<T> stringPropertyCaseInsensitiveComparator(@NotNull
                                                                                          java.lang.Class<T> beanClass,
                                                                                          @NotNull
                                                                                          java.lang.String propertyName)

getResultsSummaryNumberOrdering

@NotNull
public static com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNumberOrdering()

getResultsSummaryNameAndNumberComparator

@NotNull
public static com.google.common.collect.Ordering<ResultsSummary> getResultsSummaryNameAndNumberComparator()

getJobStagePlanNameCaseInsensitiveOrdering

@NotNull
public static com.google.common.collect.Ordering<ImmutableJob> getJobStagePlanNameCaseInsensitiveOrdering()

getApplicationBuildNumberComparator

@NotNull
public static java.util.Comparator<java.lang.String> getApplicationBuildNumberComparator()

getPlanNameResultOrdering

@NotNull
public static com.google.common.collect.Ordering<ResultsSummary> getPlanNameResultOrdering()

getVariableDefinitionContextOrdering

@NotNull
public static com.google.common.collect.Ordering<VariableDefinitionContext> getVariableDefinitionContextOrdering()

getVariableDefinitionOrdering

@NotNull
public static com.google.common.collect.Ordering<VariableDefinition> getVariableDefinitionOrdering()

getModuleDescriptorNameOrdering

@NotNull
public static com.google.common.collect.Ordering<com.atlassian.plugin.ModuleDescriptor<?>> getModuleDescriptorNameOrdering()

getPlanResultKeyOrdering

@NotNull
public static com.google.common.collect.Ordering<PlanResultKey> getPlanResultKeyOrdering()

isGreater

public static <T> boolean isGreater(@NotNull
                                    T o1,
                                    @NotNull
                                    T o2,
                                    @NotNull
                                    java.util.Comparator<T> comparator)
Returns:
true if o1 is greater than o2 according to comparator

isGreaterOrEqual

public static <T> boolean isGreaterOrEqual(@NotNull
                                           T o1,
                                           @NotNull
                                           T o2,
                                           @NotNull
                                           java.util.Comparator<T> comparator)
Returns:
true if o1 is greater or equal to o2 according to comparator

isLesser

public static <T> boolean isLesser(@NotNull
                                   T o1,
                                   @NotNull
                                   T o2,
                                   @NotNull
                                   java.util.Comparator<T> comparator)
Returns:
true if o1 is less than o2 according to comparator

isLesserOrEqual

public static <T> boolean isLesserOrEqual(@NotNull
                                          T o1,
                                          @NotNull
                                          T o2,
                                          @NotNull
                                          java.util.Comparator<T> comparator)
Returns:
true if o1 is less or equal to o2 according to comparator


Copyright © 2014 Atlassian Software Systems Pty Ltd. All Rights Reserved.