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

com.vendasta.sales.v1.internal.RevenuePeriod Maven / Gradle / Ivy

The newest version!
package com.vendasta.sales.v1.internal;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import com.vendasta.sales.v1.generated.WorkflowProto;

/**
 * 
 **/
public enum RevenuePeriod { 
	ONETIME(0),
		DAILY(1),
		WEEKLY(2),
		BIWEEKLY(3),
		MONTHLY(4),
		YEARLY(5);
	
	private static final Map protoTypeMap;
	static {
		Map aMap;
		aMap = new HashMap();
		aMap.put(WorkflowProto.RevenuePeriod.ONETIME, RevenuePeriod.ONETIME);
		aMap.put(WorkflowProto.RevenuePeriod.DAILY, RevenuePeriod.DAILY);
		aMap.put(WorkflowProto.RevenuePeriod.WEEKLY, RevenuePeriod.WEEKLY);
		aMap.put(WorkflowProto.RevenuePeriod.BIWEEKLY, RevenuePeriod.BIWEEKLY);
		aMap.put(WorkflowProto.RevenuePeriod.MONTHLY, RevenuePeriod.MONTHLY);
		aMap.put(WorkflowProto.RevenuePeriod.YEARLY, RevenuePeriod.YEARLY);
		protoTypeMap = Collections.unmodifiableMap(aMap);
	}

	private static final Map javaTypeMap;
	static {
		Map aMap;
		aMap = new HashMap();
		aMap.put(RevenuePeriod.ONETIME, WorkflowProto.RevenuePeriod.ONETIME);
		aMap.put(RevenuePeriod.DAILY, WorkflowProto.RevenuePeriod.DAILY);
		aMap.put(RevenuePeriod.WEEKLY, WorkflowProto.RevenuePeriod.WEEKLY);
		aMap.put(RevenuePeriod.BIWEEKLY, WorkflowProto.RevenuePeriod.BIWEEKLY);
		aMap.put(RevenuePeriod.MONTHLY, WorkflowProto.RevenuePeriod.MONTHLY);
		aMap.put(RevenuePeriod.YEARLY, WorkflowProto.RevenuePeriod.YEARLY);
		javaTypeMap = Collections.unmodifiableMap(aMap);
	}

	private int value;

	private RevenuePeriod(int i) {
		value = i;
	}
	public int getValue() {
		return value;
	}

	public static RevenuePeriod fromProto(WorkflowProto.RevenuePeriod proto) {
		return protoTypeMap.get(proto);
	}

	public static List fromProtos(List protos) {
		List result = new ArrayList();
		for(WorkflowProto.RevenuePeriod proto : protos) {
			result.add(RevenuePeriod.fromProto(proto));
		}
		return result;
	}

	public WorkflowProto.RevenuePeriod toProto() {
		return javaTypeMap.get(this);
	}

	public static List toProtos(List objects) {
		List result = new ArrayList();
		for(RevenuePeriod obj : objects) {
			result.add(obj.toProto());
		}
		return result;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy