| /** |
| * Copyright (c) 2009 Anyware Technologies and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Anyware Technologies - initial API and implementation |
| * |
| * $Id: JavaType.java,v 1.1 2009/02/15 15:26:22 bcabe Exp $ |
| */ |
| package org.eclipse.pde.ds.scr; |
| |
| import java.util.Arrays; |
| import java.util.Collections; |
| import java.util.List; |
| |
| import org.eclipse.emf.common.util.Enumerator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the literals of the enumeration '<em><b>Java Type</b></em>', |
| * and utility methods for working with them. |
| * <!-- end-user-doc --> |
| * @see org.eclipse.pde.ds.scr.ScrPackage#getJavaType() |
| * @model |
| * @generated |
| */ |
| public enum JavaType implements Enumerator { |
| /** |
| * The '<em><b>String</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #STRING_VALUE |
| * @generated |
| * @ordered |
| */ |
| STRING(0, "String", "String"), |
| |
| /** |
| * The '<em><b>Long</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #LONG_VALUE |
| * @generated |
| * @ordered |
| */ |
| LONG(1, "Long", "Long"), |
| |
| /** |
| * The '<em><b>Double</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #DOUBLE_VALUE |
| * @generated |
| * @ordered |
| */ |
| DOUBLE(2, "Double", "Double"), |
| |
| /** |
| * The '<em><b>Float</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #FLOAT_VALUE |
| * @generated |
| * @ordered |
| */ |
| FLOAT(3, "Float", "Float"), |
| |
| /** |
| * The '<em><b>Integer</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #INTEGER_VALUE |
| * @generated |
| * @ordered |
| */ |
| INTEGER(4, "Integer", "Integer"), |
| |
| /** |
| * The '<em><b>Byte</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #BYTE_VALUE |
| * @generated |
| * @ordered |
| */ |
| BYTE(5, "Byte", "Byte"), |
| |
| /** |
| * The '<em><b>Character</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #CHARACTER_VALUE |
| * @generated |
| * @ordered |
| */ |
| CHARACTER(6, "Character", "Character"), |
| |
| /** |
| * The '<em><b>Boolean</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #BOOLEAN_VALUE |
| * @generated |
| * @ordered |
| */ |
| BOOLEAN(7, "Boolean", "Boolean"), |
| |
| /** |
| * The '<em><b>Short</b></em>' literal object. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #SHORT_VALUE |
| * @generated |
| * @ordered |
| */ |
| SHORT(8, "Short", "Short"); |
| |
| /** |
| * The '<em><b>String</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>String</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #STRING |
| * @model name="String" |
| * @generated |
| * @ordered |
| */ |
| public static final int STRING_VALUE = 0; |
| |
| /** |
| * The '<em><b>Long</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Long</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #LONG |
| * @model name="Long" |
| * @generated |
| * @ordered |
| */ |
| public static final int LONG_VALUE = 1; |
| |
| /** |
| * The '<em><b>Double</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Double</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #DOUBLE |
| * @model name="Double" |
| * @generated |
| * @ordered |
| */ |
| public static final int DOUBLE_VALUE = 2; |
| |
| /** |
| * The '<em><b>Float</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Float</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #FLOAT |
| * @model name="Float" |
| * @generated |
| * @ordered |
| */ |
| public static final int FLOAT_VALUE = 3; |
| |
| /** |
| * The '<em><b>Integer</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Integer</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #INTEGER |
| * @model name="Integer" |
| * @generated |
| * @ordered |
| */ |
| public static final int INTEGER_VALUE = 4; |
| |
| /** |
| * The '<em><b>Byte</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Byte</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #BYTE |
| * @model name="Byte" |
| * @generated |
| * @ordered |
| */ |
| public static final int BYTE_VALUE = 5; |
| |
| /** |
| * The '<em><b>Character</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Character</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #CHARACTER |
| * @model name="Character" |
| * @generated |
| * @ordered |
| */ |
| public static final int CHARACTER_VALUE = 6; |
| |
| /** |
| * The '<em><b>Boolean</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Boolean</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #BOOLEAN |
| * @model name="Boolean" |
| * @generated |
| * @ordered |
| */ |
| public static final int BOOLEAN_VALUE = 7; |
| |
| /** |
| * The '<em><b>Short</b></em>' literal value. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of '<em><b>Short</b></em>' literal object isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @see #SHORT |
| * @model name="Short" |
| * @generated |
| * @ordered |
| */ |
| public static final int SHORT_VALUE = 8; |
| |
| /** |
| * An array of all the '<em><b>Java Type</b></em>' enumerators. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private static final JavaType[] VALUES_ARRAY = |
| new JavaType[] { |
| STRING, |
| LONG, |
| DOUBLE, |
| FLOAT, |
| INTEGER, |
| BYTE, |
| CHARACTER, |
| BOOLEAN, |
| SHORT, |
| }; |
| |
| /** |
| * A public read-only list of all the '<em><b>Java Type</b></em>' enumerators. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final List<JavaType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); |
| |
| /** |
| * Returns the '<em><b>Java Type</b></em>' literal with the specified literal value. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static JavaType get(String literal) { |
| for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
| JavaType result = VALUES_ARRAY[i]; |
| if (result.toString().equals(literal)) { |
| return result; |
| } |
| } |
| return null; |
| } |
| |
| /** |
| * Returns the '<em><b>Java Type</b></em>' literal with the specified name. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static JavaType getByName(String name) { |
| for (int i = 0; i < VALUES_ARRAY.length; ++i) { |
| JavaType result = VALUES_ARRAY[i]; |
| if (result.getName().equals(name)) { |
| return result; |
| } |
| } |
| return null; |
| } |
| |
| /** |
| * Returns the '<em><b>Java Type</b></em>' literal with the specified integer value. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static JavaType get(int value) { |
| switch (value) { |
| case STRING_VALUE: return STRING; |
| case LONG_VALUE: return LONG; |
| case DOUBLE_VALUE: return DOUBLE; |
| case FLOAT_VALUE: return FLOAT; |
| case INTEGER_VALUE: return INTEGER; |
| case BYTE_VALUE: return BYTE; |
| case CHARACTER_VALUE: return CHARACTER; |
| case BOOLEAN_VALUE: return BOOLEAN; |
| case SHORT_VALUE: return SHORT; |
| } |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private final int value; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private final String name; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private final String literal; |
| |
| /** |
| * Only this class can construct instances. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private JavaType(int value, String name, String literal) { |
| this.value = value; |
| this.name = name; |
| this.literal = literal; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getLiteral() { |
| return literal; |
| } |
| |
| /** |
| * Returns the literal value of the enumerator, which is its string representation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| return literal; |
| } |
| |
| } //JavaType |