SortBy sortBy = sortByList[i]; Ordering<Object> ordering = Ordering.from(comparator(sortBy)); if (SortOrder.DESCENDING.equals(sortBy.getSortOrder())) { ordering = ordering.reverse();
/** * Returns the sort order that matches the given string, or returns a new one if none match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static SortOrder valueOf(String code) { return valueOf(SortOrder.class, code); } }
/** Returns the list of enumerations of the same kind than this enum. */ public SortOrder[] family() { return values(); }
returnString.append(sb.getPropertyName().getPropertyName()); returnString.append(" "); returnString.append(sb.getSortOrder().name());
/** * Returns the SortOrder that matches the given string, or returns a * new one if none match it. */ public static SortOrder valueOf(String code) { if (code == null) { return null; } synchronized (VALUES) { Iterator iter = VALUES.iterator(); while (iter.hasNext()) { SortOrder type = (SortOrder) iter.next(); if (code.equalsIgnoreCase(type.name())) { return type; } } return new SortOrder(code, code); } } }
/** * Gets the encoded string. * * @return the encoded string */ public String getEncodedString() { List<String> list = new ArrayList<>(); for (SortBy sortBy : dataList) { String string = String.format( "%s %s", sortBy.getPropertyName().getPropertyName(), sortBy.getSortOrder().identifier().substring(0, 1)); list.add(string); } return String.join(", ", list); }
/** Compares this object with the specified one for equality. */ @Override public boolean equals(final Object object) { if (object instanceof NullSortBy) { return order.equals(((NullSortBy) object).order); } return false; }
returnString.append(sortBy[i].getPropertyName().getPropertyName()); returnString.append(" "); returnString.append(sortBy[i].getSortOrder().name());
/** * Returns the sort order that matches the given string, or returns a * new one if none match it. More specifically, this methods returns the first instance for * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code> * returns {@code true}. If no existing instance is found, then a new one is created for * the given name. * * @param code the name of the code to fetch or to create. * @return a code matching the given name. */ public static SortOrder valueOf(String code) { return valueOf(SortOrder.class, code); } }
/** * Returns the list of enumerations of the same kind than this enum. */ public /*{SortOrder}*/ CodeList[] family() { return values(); }
+ " " + sb.getSortOrder() .name() .charAt(0)) .collect(Collectors.joining(","));
public static SortBy getSortBy( String sortByString, List<SortTypeConfiguration> sortTypeConfigurationList, boolean supportWildcards ) { SortBy sortBy = null; if ( StringUtils.isNotBlank( sortByString ) ) { String[] sortValues = sortByString.split( "," ); String sortKey = sortValues[0]; if ( StringUtils.isNotBlank( sortKey ) ) { SortTypeConfiguration sortType = getSortConfiguration( sortKey, sortTypeConfigurationList, supportWildcards ); if ( sortType != null ) { String sortAttribute = sortType.getSortAttribute(); SortOrder sortOrder = null; if ( sortValues.length >= 3 ) { if ( Boolean.FALSE.toString().equalsIgnoreCase( sortValues[2] ) ) { sortOrder = SortOrder.DESCENDING; } else { sortOrder = SortOrder.ASCENDING; } } else { sortOrder = SortOrder.valueOf( sortType.getSortOrder() ); } sortBy = new SortByImpl( sortAttribute, sortOrder ); } } } return sortBy; }
/** * Returns the list of codes of the same kind than this code list element. * Invoking this method is equivalent to invoking {@link #values()}, except that * this method can be invoked on an instance of the parent {@code CodeList} class. * * @return all code {@linkplain #values() values} for this code list. */ @Override public SortOrder[] family() { return values(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortByImpl other = (SortByImpl) obj; if (propertyName == null) { if (other.propertyName != null) return false; } else if (!propertyName.equals(other.propertyName)) return false; if (sortOrder == null) { if (other.sortOrder != null) return false; } else if (!sortOrder.equals(other.sortOrder)) return false; return true; }
sb.getPropertyName().getPropertyName() + " " + sb.getSortOrder().name().charAt(0)) .collect(Collectors.joining(","));
if (!currOrder.equals(referenceOrder)) { throw new IllegalArgumentException( "Found two different sort orders at position "
boolean asc = sortOrder.equals(SortOrder.ASCENDING);