in rest-util/src/main/java/org/apache/archiva/components/rest/util/QueryHelper.java [135:150]
public Comparator<T> getComparator( List<String> orderBy, boolean ascending )
{
if ( ascending )
{
return orderBy.stream( ).map( this::getAttributeComparator ).filter( Objects::nonNull )
.reduce( Comparator::thenComparing )
.orElseThrow( () -> new IllegalArgumentException( "No attribute ordering found" ) );
}
else
{
return orderBy.stream( ).map( ( String name ) -> getAttributeComparator( name ) == null ? null : getAttributeComparator( name )
.reversed( ) ).filter( Objects::nonNull ).reduce( Comparator::thenComparing )
.orElseThrow( () -> new IllegalArgumentException( "No attribute ordering found" ) );
}
}