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

com.github.paganini2008.devtools.beans.streaming.Orders Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package com.github.paganini2008.devtools.beans.streaming;

import java.util.function.Function;

/**
 * 
 * Orders
 * 
 * @author Fred Feng
 * 
 * @version 1.0
 */
public abstract class Orders {

	public static > Sort descending(final String attributeName, final Class requiredType) {
		return descending(Property.forName(attributeName, requiredType));
	}

	public static > Sort ascending(final String attributeName, final Class requiredType) {
		return ascending(Property.forName(attributeName, requiredType));
	}

	public static > Sort descending(final Function function) {
		BeanSort sort = new BeanSort();
		sort.descending(function);
		return sort;
	}

	public static > Sort ascending(final Function function) {
		BeanSort sort = new BeanSort();
		sort.ascending(function);
		return sort;
	}

	public static > Sort> groupAscending(final String attributeName, final Class requiredType) {
		return groupAscending(group -> {
			return MappedBy.forName(attributeName, requiredType).apply(group.getAttributes());
		});
	}

	public static > Sort> groupDescending(final String attributeName, final Class requiredType) {
		return groupDescending(group -> {
			return MappedBy.forName(attributeName, requiredType).apply(group.getAttributes());
		});
	}

	public static > Sort> groupDescending(final GroupFunction function) {
		BeanSort> sort = new BeanSort>();
		sort.descending(function);
		return sort;
	}

	public static > Sort> groupAscending(final GroupFunction function) {
		BeanSort> sort = new BeanSort>();
		sort.ascending(function);
		return sort;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy