1 7 package org.eclipse.emf.codegen.ecore.genmodel; 8 9 import java.util.Arrays ; 10 import java.util.Collections ; 11 import java.util.List ; 12 13 import org.eclipse.emf.common.util.AbstractEnumerator; 14 15 24 public final class GenProviderKind extends AbstractEnumerator 25 { 26 35 public static final int SINGLETON = 0; 36 37 46 public static final int STATEFUL = 1; 47 48 57 public static final int NONE = 2; 58 59 71 public static final GenProviderKind SINGLETON_LITERAL = new GenProviderKind(SINGLETON, "Singleton"); 72 73 85 public static final GenProviderKind STATEFUL_LITERAL = new GenProviderKind(STATEFUL, "Stateful"); 86 87 99 public static final GenProviderKind NONE_LITERAL = new GenProviderKind(NONE, "None"); 100 101 107 private static final GenProviderKind[] VALUES_ARRAY = 108 new GenProviderKind[] 109 { 110 SINGLETON_LITERAL, 111 STATEFUL_LITERAL, 112 NONE_LITERAL, 113 }; 114 115 121 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 122 123 129 public static GenProviderKind get(String name) 130 { 131 for (int i = 0; i < VALUES_ARRAY.length; ++i) 132 { 133 GenProviderKind result = VALUES_ARRAY[i]; 134 if (result.toString().equals(name)) 135 { 136 return result; 137 } 138 } 139 return null; 140 } 141 142 148 public static GenProviderKind get(int value) 149 { 150 switch (value) 151 { 152 case SINGLETON: return SINGLETON_LITERAL; 153 case STATEFUL: return STATEFUL_LITERAL; 154 case NONE: return NONE_LITERAL; 155 } 156 return null; 157 } 158 159 165 private GenProviderKind(int value, String name) 166 { 167 super(value, name); 168 } 169 170 } | Popular Tags |