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

net.anotheria.anosite.gen.asexperiment.bean.ExperimentListItemBeanSortType Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** ExperimentListItemBeanSortType.java                                      ***
 *** generated by AnoSiteGenerator (ASG), Version: 3.2.2                      ***
 *** Copyright (C) 2005 - 2023 Anotheria.net, www.anotheria.net               ***
 *** All Rights Reserved.                                                     ***
 ********************************************************************************
 *** Don't edit this code, if you aren't sure                                 ***
 *** that you do exactly know what you are doing!                             ***
 *** It's better to invest time in the generator, as into the generated code. ***
 ********************************************************************************
 */

package net.anotheria.anosite.gen.asexperiment.bean;

import net.anotheria.util.sorter.SortType;

public class ExperimentListItemBeanSortType extends SortType{

	// Generated by: class net.anotheria.asg.generator.view.action.ModuleBeanGenerator.generateListItemSortType

	public static final int SORT_BY_ID = 1;
	public static final int SORT_BY_NAME = 2;
	public static final int SORT_BY_ACTIVE = 3;
	public static final int SORT_BY_DISTRIBUTION = 4;
	public static final int SORT_BY_DEFAULT = SORT_BY_NAME;

	public ExperimentListItemBeanSortType(){
		super(SORT_BY_DEFAULT);
	}

	public ExperimentListItemBeanSortType(int method){
		super(method);
	}

	public ExperimentListItemBeanSortType(int method, boolean order){
		super(method, order);
	}

	public static int name2method(String name){
		if ("id".equals(name))
			return SORT_BY_ID;
		if ("name".equals(name))
			return SORT_BY_NAME;
		if ("active".equals(name))
			return SORT_BY_ACTIVE;
		if ("distribution".equals(name))
			return SORT_BY_DISTRIBUTION;
		throw new RuntimeException("Unknown sort type name: "+name);
	}

	public static String method2name(int method){
		switch (method){
			case SORT_BY_ID:
				return "id";
			case SORT_BY_NAME:
				return "name";
			case SORT_BY_ACTIVE:
				return "active";
			case SORT_BY_DISTRIBUTION:
				return "distribution";
		}
		throw new RuntimeException("Unknown sort type method: "+method);
	}

	public String getMethodAndOrderCode(){
		return method2name(getSortBy())+"_"+(getSortOrder() ? "ASC":"DESC");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy