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

com.vendasta.sales.v1.internal.DurationPeriod 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 DurationPeriod { 
	UNSPECIFIED(0),
		MONTH(1),
		YEAR(2);
	
	private static final Map protoTypeMap;
	static {
		Map aMap;
		aMap = new HashMap();
		aMap.put(WorkflowProto.DurationPeriod.UNSPECIFIED, DurationPeriod.UNSPECIFIED);
		aMap.put(WorkflowProto.DurationPeriod.MONTH, DurationPeriod.MONTH);
		aMap.put(WorkflowProto.DurationPeriod.YEAR, DurationPeriod.YEAR);
		protoTypeMap = Collections.unmodifiableMap(aMap);
	}

	private static final Map javaTypeMap;
	static {
		Map aMap;
		aMap = new HashMap();
		aMap.put(DurationPeriod.UNSPECIFIED, WorkflowProto.DurationPeriod.UNSPECIFIED);
		aMap.put(DurationPeriod.MONTH, WorkflowProto.DurationPeriod.MONTH);
		aMap.put(DurationPeriod.YEAR, WorkflowProto.DurationPeriod.YEAR);
		javaTypeMap = Collections.unmodifiableMap(aMap);
	}

	private int value;

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy