/** * * Copyright (c) 2004 - 2008 André Dietisheim, Switzerland. * 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: * André Dietisheim - initial API and implementation * * * $Id: ResourceMode.java,v 1.1 2008-12-31 14:43:30 estepper Exp $ */ package org.eclipse.emf.cdo.defs; import org.eclipse.emf.cdo.CDOTransaction; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.common.util.Enumerator; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * A representation of the literals of the enumeration 'Resource Mode', and * utility methods for working with them. * * @see org.eclipse.emf.cdo.defs.CDODefsPackage#getResourceMode() * @model * @generated */ public enum ResourceMode implements Enumerator { /** * The 'GET' literal object. * * @see #GET_VALUE * @generated NOT * @ordered */ GET(0, "GET", "GET") { @Override public CDOResource getResource(String path, CDOTransaction transaction) { return transaction.getResource(path); // return transaction.getResource(path, false); } }, /** * The 'CREATE' literal object. * * @see #CREATE_VALUE * @generated NOT * @ordered */ CREATE(0, "CREATE", "CREATE") { @Override public CDOResource getResource(String path, CDOTransaction transaction) { return transaction.createResource(path); } }, /** * The 'GET OR CREATE' literal object. * * @see #GET_OR_CREATE_VALUE * @generated NOT * @ordered */ GET_OR_CREATE(0, "GET_OR_CREATE", "GET_OR_CREATE") { @Override public CDOResource getResource(String path, CDOTransaction transaction) { return transaction.getOrCreateResource(path); } }; /** * The 'GET' literal value. *

* If the meaning of 'GET' literal object isn't clear, there really should be more of a description * here... *

* * * @see #GET * @model * @generated * @ordered */ public static final int GET_VALUE = 0; /** * The 'CREATE' literal value. *

* If the meaning of 'CREATE' literal object isn't clear, there really should be more of a description * here... *

* * * @see #CREATE * @model * @generated * @ordered */ public static final int CREATE_VALUE = 0; /** * The 'GET OR CREATE' literal value. *

* If the meaning of 'GET OR CREATE' literal object isn't clear, there really should be more of a * description here... *

* * * @see #GET_OR_CREATE * @model * @generated * @ordered */ public static final int GET_OR_CREATE_VALUE = 0; /** * An array of all the 'Resource Mode' enumerators. * * @generated */ private static final ResourceMode[] VALUES_ARRAY = new ResourceMode[] { GET, CREATE, GET_OR_CREATE, }; /** * A public read-only list of all the 'Resource Mode' enumerators. * * @generated */ public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the 'Resource Mode' literal with the specified literal value. * * @generated */ public static ResourceMode get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ResourceMode result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the 'Resource Mode' literal with the specified name. * * @generated */ public static ResourceMode getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { ResourceMode result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the 'Resource Mode' literal with the specified integer value. * * @generated */ public static ResourceMode get(int value) { switch (value) { case GET_VALUE: return GET; } return null; } /** * * * @generated */ private final int value; /** * * * @generated */ private final String name; /** * * * @generated */ private final String literal; /** * Only this class can construct instances. * * @generated */ private ResourceMode(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * * * @generated */ public int getValue() { return value; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * * @generated */ @Override public String toString() { return literal; } public CDOResource getResource(String path, CDOTransaction cdoTransaction) { throw new UnsupportedOperationException("use a subclass!"); } } // ResourceMode