All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.util.SortByClause Maven / Gradle / Ivy

There is a newer version: 9.5.1
Show newest version
package com.avaje.ebeaninternal.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * A clause used to describe sorting.
 * 

* Primarily used to support sorting of Lists. *

*/ public class SortByClause { static final String NULLSHIGH = "nullshigh"; static final String NULLSLOW = "nullslow"; /** * The ascending keyword. */ static final String ASC = "asc"; /** * The descending keyword. */ static final String DESC = "desc"; private final List properties = new ArrayList<>(); /** * Return the number of properties in the clause. */ public int size() { return properties.size(); } /** * Return the properties of the sort by clause. */ public List getProperties() { return properties; } /** * Add a property to the sort by clause. */ public void add(Property p) { properties.add(p); } /** * A property of the SortByClause. */ public static class Property implements Serializable { private static final long serialVersionUID = 7588760362420690963L; private final String name; private final boolean ascending; private final Boolean nullsHigh; public Property(String name, boolean ascending, Boolean nullsHigh) { this.name = name; this.ascending = ascending; this.nullsHigh = nullsHigh; } public String toString() { return name + " asc:" + ascending; } /** * Return the property name. */ public String getName() { return name; } /** * Return true if the order should be ascending. */ public boolean isAscending() { return ascending; } public Boolean getNullsHigh() { return nullsHigh; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy