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 GenPropertyKind extends AbstractEnumerator 25 { 26 35 public static final int EDITABLE = 0; 36 37 46 public static final int READONLY = 1; 47 48 57 public static final int NONE = 2; 58 59 71 public static final GenPropertyKind EDITABLE_LITERAL = new GenPropertyKind(EDITABLE, "Editable"); 72 73 85 public static final GenPropertyKind READONLY_LITERAL = new GenPropertyKind(READONLY, "Readonly"); 86 87 99 public static final GenPropertyKind NONE_LITERAL = new GenPropertyKind(NONE, "None"); 100 101 107 private static final GenPropertyKind[] VALUES_ARRAY = 108 new GenPropertyKind[] 109 { 110 EDITABLE_LITERAL, 111 READONLY_LITERAL, 112 NONE_LITERAL, 113 }; 114 115 121 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 122 123 129 public static GenPropertyKind get(String name) 130 { 131 for (int i = 0; i < VALUES_ARRAY.length; ++i) 132 { 133 GenPropertyKind 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 GenPropertyKind get(int value) 149 { 150 switch (value) 151 { 152 case EDITABLE: return EDITABLE_LITERAL; 153 case READONLY: return READONLY_LITERAL; 154 case NONE: return NONE_LITERAL; 155 } 156 return null; 157 } 158 159 165 private GenPropertyKind(int value, String name) 166 { 167 super(value, name); 168 } 169 170 } | Popular Tags |