diff options
Diffstat (limited to 'plugins/org.eclipse.jem/mofjava')
67 files changed, 0 insertions, 17483 deletions
diff --git a/plugins/org.eclipse.jem/mofjava/javaadapters.properties b/plugins/org.eclipse.jem/mofjava/javaadapters.properties deleted file mode 100644 index c8d8a81a9..000000000 --- a/plugins/org.eclipse.jem/mofjava/javaadapters.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 2005 IBM Corporation 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: -# IBM Corporation - initial API and implementation -############################################################################### -# -# $Source: /cvsroot/webtools/jeetools.move/webtools.javaee.git/plugins/org.eclipse.jem/mofjava/javaadapters.properties,v $ -# $Revision: 1.5 $ $Date: 2005/08/24 20:20:25 $ -# - -Failed_reflecting_values_ERROR_ = IWAV0002E Failed reflecting values. -Could_Not_Reflect_Methods_ERROR_ = IWAV0003E Could not reflect methods for {0} because one of the methods references a type that could not be loaded. Exception: {1} -Could_Not_Reflect_Constructors_ERROR_ = IWAV0142E Could not reflect constructors for {0} because one of the methods references a type that could not be loaded. Exception: {1} -Could_Not_Reflect_Fields_ERROR_ = IWAV0143E Could not reflect fields for {0} because one of the fields is a type that could not be loaded. Exception: {1} -Error_Looking_Up_Type_ERROR_ = IWAV0144E Error looking up type {0}. Exception: {1} -Error_Introspecting_Flags_ERROR_ = IWAV0145E Error introspecting flags on {0}. Exception: {1} -Error_Setting_GenFlag_ERROR_ = IWAV0153E Error setting the generated flag on {0}. Exception: {1} -Java_Inh_Cycle_ERROR_ = IWAV0154E Detected an inheritance cycle when {0} trys to extend {1}. - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/core/JEMPlugin.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/core/JEMPlugin.java deleted file mode 100644 index 08cf242ed..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/core/JEMPlugin.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JEMPlugin.java,v $ - * $Revision: 1.8 $ $Date: 2005/08/24 20:20:25 $ - */ -package org.eclipse.jem.internal.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jem.util.logger.proxyrender.EclipseLogger; - - -/** - * org.eclipse.jem plugin - */ -public class JEMPlugin extends Plugin { - - private static JEMPlugin PLUGIN; - private Logger logger; - - public JEMPlugin() { - PLUGIN = this; - } - - public static JEMPlugin getPlugin() { - return PLUGIN; - } - - - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - logger = EclipseLogger.getEclipseLogger(this); - } - - public Logger getLogger() { - return logger; - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java deleted file mode 100644 index 95cbb9009..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaClassAdaptor.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: IJavaClassAdaptor.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:25 $ - */ -/** - * Insert the type's description here. - * Creation date: (8/27/2001 1:17:46 PM) - * @author: Administrator - */ -public interface IJavaClassAdaptor { -/** - * Return true if the sourceType is null or if - * it is a binary type. - */ -boolean isSourceTypeFromBinary() ; -/** - * Return true if the sourceType can be found. - */ -boolean sourceTypeExists() ; - -/** - * Reflect the fields - * @return <code>true</code> if reflection occurred. - * - * @since 1.0.0 - */ -boolean reflectFieldsIfNecessary(); - -/** - * Reflect the methods. - * @return <code>true</code> if reflection occurred. - * - * @since 1.0.0 - */ -boolean reflectMethodsIfNecessary(); -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaMethodAdapter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaMethodAdapter.java deleted file mode 100644 index 550630be2..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/IJavaMethodAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IJavaMethodAdapter.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:25 $ - */ -package org.eclipse.jem.internal.java.adapters; - - -/** - * Used to reflect methods - * @since 1.0.0 - */ -public interface IJavaMethodAdapter { - - /** - * Reflect the generated if necessary. - * @return <code>true</code> if reflection occurred. - * - * @since 1.0.0 - */ - public boolean reflectGeneratedIfNecessary(); - - /** - * Reflect the names of the method parameters if necessary. - * @return <code>true</code> if reflection occurred. - * - * @since 1.0.0 - */ - public boolean reflectParamNamesIfNecessary(); -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/InternalReadAdaptable.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/InternalReadAdaptable.java deleted file mode 100644 index 7b6feb49b..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/InternalReadAdaptable.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: InternalReadAdaptable.java,v $ - * $Revision: 1.3 $ $Date: 2005/08/24 20:20:25 $ - */ - -public interface InternalReadAdaptable extends org.eclipse.emf.common.notify.Notifier { -/** - * Implementers of this interface need to contain the following method - * implementations: - * public Object primRefValue(EObject a) { - * return super.getValue(a); - * } - * public Object getValue(EObject a) { - * return ReflectionAdaptor.getValue(this, a); - * } - */ -//public Object primRefValue(EObject a); -void setReflected(boolean aBoolean); -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java deleted file mode 100644 index 60c62814a..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaArrayTypeReflectionAdapter.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaArrayTypeReflectionAdapter.java,v $ - * $Revision: 1.8 $ $Date: 2005/09/14 23:30:35 $ - */ -package org.eclipse.jem.internal.java.adapters; - -import java.util.List; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jem.java.ArrayType; -import org.eclipse.jem.java.InheritanceCycleException; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jem.java.internal.impl.ArrayTypeImpl; - -/** - * Array type reflection adapter. Since arrays are very constant we don't need any fancy reflection to the source type (class object). It really - * doesn't do anything. It is just here so that it exists. Everything is constant or depends on the final component type. - * - * @since 1.0.0 - */ -public class JavaArrayTypeReflectionAdapter extends JavaReflectionAdaptor implements IJavaClassAdaptor { - - public JavaArrayTypeReflectionAdapter(Notifier target) { - super(target); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#getReflectionSource() - */ - public Object getReflectionSource() { - return null; // There isn't any for arrays. - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#hasReflectionSource() - */ - public boolean hasReflectionSource() { - // This method is used to determine if valid, so we pass on to use the final component. - ArrayType jh = (ArrayType) getTarget(); - JavaHelpers fc = jh.getFinalComponentType(); - return (fc.isPrimitive() || ((JavaClass) fc).isExistingType()); - } - - public boolean hasCachedReflectionSource() { - ArrayType jh = (ArrayType) getTarget(); - JavaHelpers fc = jh.getFinalComponentType(); - if(fc.isPrimitive()) - return true; - else { - JavaReflectionAdaptor reflectionAdaptor = (JavaReflectionAdaptor) EcoreUtil.getExistingAdapter(fc, ReflectionAdaptor.TYPE_KEY); - return (reflectionAdaptor != null) ? reflectionAdaptor.hasCachedReflectionSource() : false; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.java.adapters.ReflectionAdaptor#reflectValues() - */ - public boolean reflectValues() { - ArrayTypeImpl at = (ArrayTypeImpl) getTarget(); - - // Arrays are always: - // final - // Supertype of java.lang.Object - // implements java.lang.Cloneable, java.io.Serializable - at.setFinal(true); - try { - at.setSupertype((JavaClass) JavaRefFactory.eINSTANCE.reflectType("java.lang.Object", (EObject) getTarget())); //$NON-NLS-1$ - } catch (InheritanceCycleException e) { - } - List list = at.getImplementsInterfacesGen(); - list.add(JavaRefFactory.eINSTANCE.createClassRef("java.lang.Cloneable")); //$NON-NLS-1$ - list.add(JavaRefFactory.eINSTANCE.createClassRef("java.io.Serializable")); //$NON-NLS-1$ - return super.reflectValues(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#flushReflectedValues(boolean) - */ - protected boolean flushReflectedValues(boolean clearCachedModelObject) { - ArrayTypeImpl at = (ArrayTypeImpl) getTarget(); - at.getImplementsInterfacesGen().clear(); - return true; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#isSourceTypeFromBinary() - */ - public boolean isSourceTypeFromBinary() { - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#reflectFieldsIfNecessary() - */ - public synchronized boolean reflectFieldsIfNecessary() { - return reflectValuesIfNecessary(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#reflectMethodsIfNecessary() - */ - public synchronized boolean reflectMethodsIfNecessary() { - return reflectValuesIfNecessary(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor#sourceTypeExists() - */ - public boolean sourceTypeExists() { - return hasReflectionSource(); - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdapterFactory.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdapterFactory.java deleted file mode 100644 index 9bb360d00..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdapterFactory.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: JavaReflectionAdapterFactory.java,v $ - * $Revision: 1.7 $ $Date: 2005/08/24 20:20:25 $ - */ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.jem.java.JavaRefPackage; -public abstract class JavaReflectionAdapterFactory extends AdapterFactoryImpl { - // Maintain a mapping of the source objects to the adaptors which have - // relfected from them. This allows a flush operation to force those - // adapters to re-reflect. - protected HashMap reflected = new HashMap(); - /** - * Key for the type of adapters that this factory creates. (Used in isFactoryForType()). - */ - public static final String TYPE_KEY = ReadAdaptor.TYPE_KEY; - protected boolean isBusyIteratingReflected = false; - protected Map registerQueue; - protected List unregisterQueue; -/** - * JavaReflectionAdapterFactory constructor comment. - */ -public JavaReflectionAdapterFactory() { - super(); -} -public Adapter createAdapter(Notifier target) { - ReflectionAdaptor adapter = null; - EObject object = (EObject) target; - JavaRefPackage pack = getJavaRefPackage(); - if (object.eClass() == pack.getJavaClass()) - adapter = createJavaClassAdaptor(target); - else - if (object.eClass() == pack.getArrayType()) - adapter = createArrayTypeAdaptor(target); - else - if (object.eClass() == pack.getMethod()) - adapter = createJavaMethodAdaptor(target); - else - if (object.eClass() == pack.getField()) - adapter = createJavaFieldAdaptor(target); - return adapter; -} - -protected ReflectionAdaptor createArrayTypeAdaptor(Notifier target) { - return new JavaArrayTypeReflectionAdapter(target); -} - -protected abstract ReflectionAdaptor createJavaClassAdaptor(Notifier target) ; -protected abstract ReflectionAdaptor createJavaFieldAdaptor(Notifier target) ; -protected abstract ReflectionAdaptor createJavaMethodAdaptor(Notifier target) ; -// Flush the adapter for a source object -public Notification disAssociateSource(String source) { - return disAssociateSource(source, true); -} - -public Notification disAssociateSource(String source, boolean doNotify) { - JavaReflectionAdaptor a = (JavaReflectionAdaptor) reflected.get(source); - Notification notification = null; - if (a != null) { - if (doNotify) - a.releaseSourceType(); - else - notification = a.releaseSourceTypeNoNotification(); - } - return notification; -} -public void flushAll() {} -// Flush the adapter for a source object -public void flushReflection(String source) {} -protected JavaRefPackage getJavaRefPackage() { - return (JavaRefPackage) EPackage.Registry.INSTANCE.getEPackage(JavaRefPackage.eNS_URI); -} -public void registerReflection(String source, ReflectionAdaptor adapter) { - if (isBusyIteratingReflected) { - if (registerQueue == null) - registerQueue = new HashMap(); - registerQueue.put(source, adapter); - } else - reflected.put(source, adapter); -} -public void unregisterReflection(String source) { - if (isBusyIteratingReflected) { - if (unregisterQueue == null) - unregisterQueue = new ArrayList(); - unregisterQueue.add(source); - } else - reflected.remove(source); -} -public void disAssociateSourcePlusInner(String source) { - disAssociateSourcePlusInner(source, true); -} - -public Notification disAssociateSourcePlusInner(String source, boolean doNotify) { - isBusyIteratingReflected = true; - Notification notification = null; - try { - String innerName = source + '$'; - Iterator it = reflected.entrySet().iterator(); - Map.Entry entry; - String key; - JavaReflectionAdaptor adaptor; - while (it.hasNext()) { - entry = (Map.Entry) it.next(); - key = (String) entry.getKey(); - if (key.equals(source) || key.startsWith(innerName)) { - adaptor = (JavaReflectionAdaptor) reflected.get(key); - if (adaptor != null) { - if (doNotify) - adaptor.releaseSourceType(); - else - notification = adaptor.releaseSourceTypeNoNotification(); - } - } - } - } finally { - finishedIteratingReflected(); - } - return notification; -} - -protected void finishedIteratingReflected() { - isBusyIteratingReflected = false; - if (unregisterQueue != null && !unregisterQueue.isEmpty()) { - for (int i = 0; i < unregisterQueue.size(); i++) { - reflected.remove(unregisterQueue.get(i)); - } - unregisterQueue.clear(); - } - if (registerQueue != null && !registerQueue.isEmpty()) { - Iterator it = registerQueue.entrySet().iterator(); - Map.Entry entry; - while (it.hasNext()) { - entry = (Map.Entry) it.next(); - reflected.put(entry.getKey(), entry.getValue()); - } - registerQueue.clear(); - } -} -public boolean isFactoryForType(Object type) { - return TYPE_KEY.equals(type); -} -} - - - - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java deleted file mode 100644 index 4e37f0b4f..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionAdaptor.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: JavaReflectionAdaptor.java,v $ - * $Revision: 1.15 $ $Date: 2006/05/17 20:13:07 $ - */ -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.*; -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.jem.java.*; -import org.eclipse.jem.util.logger.proxy.Logger; - -/** - * - */ -public abstract class JavaReflectionAdaptor extends ReflectionAdaptor { - private static final String C_METHOD_DEFAULT_CTOR = String.valueOf(C_METHOD_PARM_DELIMITER) + S_CONSTRUCTOR_TOKEN; - protected static final String LEFT_BRACKET = "[";//$NON-NLS-1$ - - /** - * Special notification event type. This is sent against a JavaClass (as the target) whenever flush of the reflection occurs. It will be - * sent under the notification event type of REFLECTION_EVENT. - * @since 1.1.0 - */ - public static final EAttribute FLUSH_REFLECTION_EVENT = EcorePackage.eINSTANCE.getEcoreFactory().createEAttribute(); - - /** - * Special notification event type. This is sent against a JavaClass (as the target) whenever flush of a new class (i.e. - * no source was found) of the reflection occurs. It will be - * sent under the notification event type of REFLECTION_EVENT. - * @since 1.1.0 - */ - public static final EAttribute FLUSH_NEW_REFLECTION_EVENT = EcorePackage.eINSTANCE.getEcoreFactory().createEAttribute(); - - /* - * Fill in the name. Not really needed but it would be nice. - */ - static { - FLUSH_REFLECTION_EVENT.setName("flushReflectedValues"); //$NON-NLS-1$ - FLUSH_NEW_REFLECTION_EVENT.setName("flushNewReflectedValues"); //$NON-NLS-1$ - } - protected boolean hasFlushed = false; - protected boolean isFlushing = false; -/** - * JavaReflectionAdapter constructor comment. - */ -public JavaReflectionAdaptor() { - super(); -} -/** - * JavaReflectionAdapter constructor comment. - * @param target org.eclipse.emf.common.notify.Notifier - */ -public JavaReflectionAdaptor(org.eclipse.emf.common.notify.Notifier target) { - super(target); -} -/** - * createBlock - instantiate a Block containing the passed source - */ -public Block createBlock(String name, String sourceString) { - Block newBlock = getJavaFactory().createBlock(); - newBlock.setName(name + "_" + "block");//$NON-NLS-2$//$NON-NLS-1$ - newBlock.setSource(sourceString); - return newBlock; -} -/** - * setSuper - set our supertype here, implemented interface are handled separately - */ -public JavaClass createJavaClassRef(String targetName) { - return JavaRefFactory.eINSTANCE.createClassRef(targetName); -} -/** - * createJavaParameter - instantiate a Java Parameter based on the passed name and type name (a simple name, NOT A SIGNATURE!!!) - * The id for a parameter has to be complex in order to be parsable into class, method, and parm. - * It is created by appending the parm name to the method id, with a known separator. - * It will look something like "Foo.doSomething(java.lang.Integer-arg0" - */ -public JavaParameter createJavaParameter(Method parentMethod, String parmName, String parmTypeName) { - JavaParameter newParm = getJavaFactory().createJavaParameter(); - if (parmName!=null) - newParm.setName(parmName); -// ((InternalEObject)newParm).eSetID(parentMethod.eID() + C_METHODID_PARMID_DELIMITER + parmName); - String classRefString = parmTypeName; - newParm.setEType(createJavaClassRef(classRefString)); - return newParm; -} -/** - * This method will return a List of dimensions for a typeName. - * For example "foo[][]" would return a List of Integers - * 1, 1. At some point we may want to actually capture the size - * for Fields but we would need the initializer source to determine that. - */ -public List getArrayDimensions(String typeName) { - List dimensions = new java.util.ArrayList(); - if (typeName != null) { - int begin = 0; - int index = -1; - while (begin < typeName.length()) { - index = typeName.indexOf(LEFT_BRACKET, begin); - if (index > -1) { - dimensions.add(new Integer(1)); - begin = index + 1; - } else { - begin = typeName.length(); - } - } - } - return dimensions; -} -/* Get the Java Factory - */ -protected static JavaRefFactory getJavaFactory() { - return ((org.eclipse.jem.java.JavaRefPackage)EPackage.Registry.INSTANCE.getEPackage(org.eclipse.jem.java.JavaRefPackage.eNS_URI)).getJavaRefFactory(); -} -public abstract Object getReflectionSource(); -/** - * getTypeNamesFromMethodUUID - Pull the parm type names out of a method ID - * It will be in the form: "simpleclass.methodName(com.fronk.Parm1_type,parm2type" - */ -protected static String[] getTypeNamesFromMethodID(String methodID) { - if (methodID.charAt(methodID.length()-1) == C_METHOD_PARM_DELIMITER || methodID.endsWith(C_METHOD_DEFAULT_CTOR)) - return emptyStringArray; - - // Count the parms first. The number of parms is the number of occurrences of ',' + 1 - int numParms = 1; - int pos = -1; - // Skip the '.' after classname - pos = methodID.indexOf(C_CLASS_MEMBER_DELIMITER, ++pos); - // Look for the start of the parms - int parmPos = methodID.indexOf(C_METHOD_PARM_DELIMITER, ++pos); - pos = parmPos; - while ((pos = methodID.indexOf(C_PARM_PARM_DELIMITER, ++pos)) != -1) - numParms++; - String[] parmTypeNames = new String[numParms]; - // now collect the parm names - // skip the method name - pos = parmPos; - int i = 0, end; - do { - end = methodID.indexOf(C_PARM_PARM_DELIMITER, pos + 1); - // This is the last parameter, we may need to strip a trailing &V for a constructor - if (end == -1) - end = methodID.indexOf(S_CONSTRUCTOR_TOKEN, pos + 1); - // otherwise take the rest of the ID - if (end == -1) - end = methodID.length(); - parmTypeNames[i++] = methodID.substring(pos + 1, end); - } while ((pos = methodID.indexOf(C_PARM_PARM_DELIMITER, ++pos)) != -1); - return parmTypeNames; -} -public abstract boolean hasCachedReflectionSource(); - -public boolean hasReflectionSource() { - return getReflectionSource() != null; -} - -/** - * Subclasses should override. - * - */ -public void releaseSourceType(){ -} - -/** - * Subclasses should override. - * @return - */ -public Notification releaseSourceTypeNoNotification() { - return null; -} - -public static void releaseSourceType(JavaClass javaClass) { - if (javaClass == null) - return; - - JavaReflectionAdaptor existing = (JavaReflectionAdaptor) retrieveAdaptorFrom(javaClass); - if (existing != null) - existing.releaseSourceType(); -} -/* - * This method is called by a Field Adaptor to set the type of aField - * to be aTypeName. aTypeName may contain array brackets which need - * to be detected in order to set the array dimensions on aField. - */ -protected void setFieldType(Field aField, String aTypeName) { - if (aField != null && aTypeName != null) { - String classRefString = aTypeName; - aField.setEType(createJavaClassRef(classRefString)); - } -} -public final boolean flushReflectedValuesIfNecessary() { - return flushReflectedValuesIfNecessary(false); -} -public final boolean flushReflectedValuesIfNecessary(boolean clearCachedModelObject) { - Notification not = flushReflectedValuesIfNecessaryNoNotification(clearCachedModelObject); - if (not != null) - getTarget().eNotify(not); - return hasFlushed; -} - -public synchronized Notification flushReflectedValuesIfNecessaryNoNotification(boolean clearCachedModelObject) { - if (!hasFlushed && !isFlushing) { - boolean isExisting = hasCachedReflectionSource(); - try { - isFlushing = true; - hasReflected = false; - hasFlushed = flushReflectedValues(clearCachedModelObject); - } catch (Throwable e) { - hasFlushed = false; - Logger.getLogger().log(e); - if (e instanceof RuntimeException) - throw (RuntimeException) e; - else if (e instanceof Error) - throw (Error) e; - else - throw new RuntimeException(e.getMessage()); - } finally { - isFlushing = false; - postFlushReflectedValuesIfNecessary(isExisting); - } - return createFlushNotification(isExisting); - } - return null; -} - -/** - * @param isExisting - * @return - */ -protected Notification createFlushNotification(boolean isExisting) { - EStructuralFeature feature = isExisting ? FLUSH_REFLECTION_EVENT : FLUSH_NEW_REFLECTION_EVENT; - return new ENotificationImpl((InternalEObject)getTarget(),EVENT, feature, null, null); -} -protected void postFlushReflectedValuesIfNecessary(boolean isExisting) { -} -/** - * Subclasses should override to perform the actual clearing of the values. - */ -protected boolean flushReflectedValues(boolean clearCachedModelObject) { - return true; -} -/** - * Return a boolean indicating whether reflection had occurred. - */ -public boolean reflectValuesIfNecessary() { - if (isFlushing) - return false; - return super.reflectValuesIfNecessary(); -} - -/** - * reflectValues - template method, subclasses override to pump values into target - */ -public boolean reflectValues() { - hasFlushed = false; - return true; -} -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionKey.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionKey.java deleted file mode 100644 index c10096145..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaReflectionKey.java +++ /dev/null @@ -1,398 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: JavaReflectionKey.java,v $ - * $Revision: 1.10 $ $Date: 2006/05/17 20:13:07 $ - */ -import java.util.*; - -import org.eclipse.emf.ecore.*; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.jem.java.*; -import org.eclipse.jem.java.adapters.IJavaReflectionKey; -import org.eclipse.jem.java.adapters.IJavaReflectionKeyExtension; -import org.eclipse.jem.util.CharacterUtil; -import org.eclipse.jem.util.CharacterUtil.StringIterator; - -/** - * This key handles Java Reflection. It creates the appropriate type of entries if - * they are not already in the resource. There is an extension mechanism for other - * types of ids that are not recognized by this key. They are registered with the - * JavaXMIFactory that is used to create these keys, and the factory will pass in - * a List of these registered extension processers (IJavaReflectionKeyExtension). - * - * Creation date: (10/4/2000 8:24:36 AM) - * @author: Administrator - */ -public class JavaReflectionKey implements IJavaReflectionKey { - private static final Collection PRIMITIVES = new ArrayList(8); - - static { initializePrimitivesCollection(); } - - protected JavaXMIFactoryImpl.JavaXMIResource resource; //FB - protected List extensions; - -public JavaReflectionKey(List extensions, JavaXMIFactoryImpl.JavaXMIResource resource) { - this.extensions = extensions; - this.resource = resource; -} -//FB END - -/* - * Create an ArrayType instance in the current document - * Handles the push and pop of the current document. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#createArrayType() - */ -public ArrayType createArrayType() { - return getJavaFactory().createArrayType(); -} -/* - * Create a JavaClass instance in the current document - * Handles the push and pop of the current document. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#createJavaClass() - */ -public JavaClass createJavaClass() { - return getJavaFactory().createJavaClass(); -} -/** - * Create a data type and put it in the primitives resource - */ -protected EClassifier getJavaDataType(String typeName) { - JavaDataType result = getJavaFactory().createJavaDataType(); - result.setName(typeName); - // ((InternalEObject)result).eSetID(typeName); - //result.eSetUUID((UUID) null); - //result.setEPackage(getPackage()); - getPackage().getEClassifiers().add(result); - resource.setID(result, typeName); - return result; -} -/* - * Create a Field instance in the current document - * Handles the push and pop of the current document. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#createJavaField() - */ -public Field createJavaField() { - return getJavaFactory().createField(); -} -/* - * Create a Method instance in the current document - * Handles the push and pop of the current document. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#createJavaMethod() - */ -public Method createJavaMethod() { - return getJavaFactory().createMethod(); -} -/* - * Create a JavaParameter instance in the current document - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#createJavaParameter() - */ -public JavaParameter createJavaParameter() { - return getJavaFactory().createJavaParameter(); -} -//FB/** -//FB * Override to try to introspect objects -//FB * that aren't found using the default mechanism. -//FB */ -//FBpublic Object get(Object key) { -//FB Object javaObject = super.get(key); -//FB if (javaObject == null) { -//FB javaObject = getObjectFromExtensions((String) key); -//FB if (javaObject == null) -//FB javaObject = getJavaObject((String) key); -//FB } -//FB return javaObject; -//FB} - -//FB ADDED -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#get(java.lang.String) - */ -public Object get(String key) { - Object javaObject = getObjectFromExtensions(key); - if (javaObject == null) - javaObject = getJavaObject(key); - return javaObject; -} -//FB END - -/* - * Instantiate the named class. - * If we make it to this point, the class has not yet been instantiated or reflected. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#getArrayType(java.lang.String) - */ -public EClassifier getArrayType(String typeName) { - ArrayType arrayType = this.createArrayType(); - arrayType.setName(typeName); - // ((InternalEObject)arrayType).eSetID(typeName); - //arrayType.eSetUUID((UUID) null); - int pos = -1, braces = 0; - do { - pos = typeName.indexOf("[", pos+1);//$NON-NLS-1$ - if (pos != -1) - braces++; - } while (pos != -1); - arrayType.setArrayDimensions(braces); - //arrayType.setEPackage(getPackage()); - getPackage().getEClassifiers().add(arrayType); - resource.setID(arrayType, typeName); - return arrayType; -} -/* - * Instantiate the named class. - * If we make it to this point, teh class has not yet been instantiated or reflected. - */ -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#getJavaClass(java.lang.String) - */ -public EClassifier getJavaClass(String typeName) { - JavaClass javaClass = this.createJavaClass(); - javaClass.setName(typeName); - // ((InternalEObject)javaClass).eSetID(javaClass.getName()); - //javaClass.eSetUUID((UUID) null); - // javaClass.setEPackage(getPackage()); - getPackage().getEClassifiers().add(javaClass); - resource.setID(javaClass, typeName); - return javaClass; -} -/* Get the Java Factory - */ -protected static JavaRefFactory getJavaFactory() { - return JavaRefFactory.eINSTANCE; -} -/** - * This allows for the direct retrieval of fields with the following notation: - * field: java:/com.ibm.foo#Test.foo - * - */ -protected Field getJavaField(String keyValue) { - Field result = null; - String className, memberName; - int memberDelimiter = keyValue.indexOf(ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER); - className = keyValue.substring(0, memberDelimiter); - memberName = keyValue.substring(memberDelimiter + 1); - EClassifier javaClass = (EClassifier) primGet(className); - // if we haven't already instantiated the containing class, then go do it. - if (javaClass == null) - javaClass = getJavaType(className); - if ((javaClass != null) && !((JavaHelpers) javaClass).isPrimitive()) { - // We have a class. Now we need to force reflection, this will cause - // the JavaReflectionKey to be updated and have the member added to the - // list. - ((JavaClass) javaClass).getFields(); - //FB result = (Field) super.get(keyValue); // It should now be registered. - result = (Field) primGet(keyValue); // It should now be registered. - - if (result == null) { - Field tempField = createJavaField(); - tempField.setName(memberName); - // ((InternalEObject)tempField).eSetID(keyValue); - //tempField.eSetUUID((UUID) null); - ((JavaClass) javaClass).getFields().add(tempField); - result = tempField; - } - } - return result; -} -/** - * This allows for the retrieval of methods with the following notation: - * method: java:/com.ibm.foo#Test.foofoo( - * - */ -protected Method getJavaMethod(String keyValue) { - Method result = null; - String className, memberName; - int memberDelimiter = keyValue.indexOf(ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER); - className = keyValue.substring(0, memberDelimiter); - int parmDelimiter = keyValue.indexOf(ReflectionAdaptor.C_METHOD_PARM_DELIMITER, memberDelimiter); - memberName = keyValue.substring(memberDelimiter + 1, parmDelimiter); - EClassifier javaClass = (EClassifier) primGet(className); - // if we haven't already instantiated the containing class, then go do it. - if (javaClass == null) - javaClass = getJavaType(className); - if ((javaClass != null) && !((JavaHelpers) javaClass).isPrimitive()) { - // We have a class. Now we need to force reflection, this will cause - // the JavaReflectionKey to be updated and have the member added to the - // list. - ((JavaClass) javaClass).getMethods(); - result = (Method) primGet(keyValue); // It should now be registered. - - if (result == null) { - Method tempMethod = createJavaMethod(); - tempMethod.setName(memberName); - resource.setID(tempMethod, keyValue); - ((JavaClass) javaClass).getMethods().add(tempMethod); - result = tempMethod; - } - } - return result; -} -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#getJavaObject(java.lang.String) - */ -public EObject getJavaObject(String keyValue) { - EObject result = null; - int index = keyValue.indexOf(ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER); - if (index > 0) { - // The reference is to a member: field, method, or parameter. - // Take the most specific case first, a parameter. - // Only a parameter should contain the methodID to parmID delimiter. - boolean isParameter = (keyValue.indexOf(ReflectionAdaptor.C_METHODID_PARMID_DELIMITER, index) != -1); - if (isParameter) { - result = getJavaParameter(keyValue); - } else { - // The target is a field or method. If it has a "(", then it is a method. - // If it is not found, then we will create a temporary object. - int parmStart = keyValue.indexOf(ReflectionAdaptor.C_METHOD_PARM_DELIMITER, index); - boolean isField = parmStart == -1; - if (isField) { - result = getJavaField(keyValue); - } else { - result = getJavaMethod(keyValue); - } - } - } else { - result = getJavaType(keyValue); - } - return result; -} - -/** - * See if the extensions can resolve this first. - */ -protected Object getObjectFromExtensions(String keyValue) { - if (extensions != null) { - for (Iterator iter = extensions.iterator(); iter.hasNext();) { - IJavaReflectionKeyExtension extension = (IJavaReflectionKeyExtension) iter.next(); - Object obj = extension.getObject(keyValue, this); - if (obj != null) - return obj; - } - } - - return null; -} -/** - * This allows for the retrieval of parameters with the following notation: - * parameter: java:/com.ibm.foo#Test.foofoo(-arg0 - * - */ -protected JavaParameter getJavaParameter(String keyValue) { - JavaParameter result = null; - String parmName; - int memberDelimiter = keyValue.indexOf(ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER); - int parmDelimiter = keyValue.indexOf(ReflectionAdaptor.C_METHODID_PARMID_DELIMITER, memberDelimiter); - parmName = keyValue.substring(parmDelimiter + 1); - // getMethod() will find or create a method - Method method = this.getJavaMethod(keyValue.substring(parmDelimiter)); - if (method != null) { - result = method.getParameter(parmName); - if (result == null) { - JavaParameter tempParameter = createJavaParameter(); - tempParameter.setName(parmName); - // ((InternalEObject)tempParameter).eSetID(keyValue); - // tempParameter.eSetUUID((UUID) null); - method.getParameters().add(tempParameter); - result = tempParameter; - } - } - return result; -} -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#getJavaType(java.lang.String) - */ -public EClassifier getJavaType(String typeName) { - if (isPrimitive(typeName)) - return getJavaDataType(typeName); - else if (isArray(typeName)) - return getArrayType(typeName); - else if (isValidJavaIdentifier(typeName)) - return getJavaClass(typeName); - return null; -} - -protected boolean isValidJavaIdentifier(String typeName) { - if (typeName.length() > 0) { - StringIterator charIter = new StringIterator(typeName); - if (CharacterUtil.isJavaIdentifierStart(charIter.next())) { - // Starts with a valid java identifier character. - // Now see if the rest are valid. - while (charIter.hasNext()) { - if (!CharacterUtil.isJavaIdentifierPart(charIter.next())) - return false; // Not valid - } - return true; - } - } - return false; -} - -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#primGet(java.lang.String) - */ -public Object primGet(String key) { - return resource.primGetEObject(key); -} -protected EPackage getPackage() { - //FB return (EPackage) super.get(JavaPackage.PACKAGE_ID); - // return (EPackage) resource.getEObject(JavaPackage.PACKAGE_ID); //FB - //return (EPackage) resource.getEObject(JavaPackage.PACKAGE_ID); //FB - return (EPackage)EcoreUtil.getObjectByType(resource.getContents(), EcorePackage.eINSTANCE.getEPackage()); -} -/** - * Insert the method's description here. - * Creation date: (10/4/2000 9:56:53 AM) - */ -private static void initializePrimitivesCollection() { - PRIMITIVES.add(N_VOID); - PRIMITIVES.add(N_BOOLEAN); - PRIMITIVES.add(N_BYTE); - PRIMITIVES.add(N_CHAR); - PRIMITIVES.add(N_DOUBLE); - PRIMITIVES.add(N_FLOAT); - PRIMITIVES.add(N_INT); - PRIMITIVES.add(N_LONG); - PRIMITIVES.add(N_SHORT); -} -/* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaReflectionKey#isArray(java.lang.String) - */ -public boolean isArray(String typeName) { - return typeName.endsWith("[]");//$NON-NLS-1$ -} -/** - * Insert the method's description here. - * Creation date: (10/4/2000 9:54:23 AM) - * @return boolean - * @param typeName java.lang.String - */ -private boolean isPrimitive(String typeName) { - return PRIMITIVES.contains(typeName); -} -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaXMIFactoryImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaXMIFactoryImpl.java deleted file mode 100644 index 0fda308d7..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/JavaXMIFactoryImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: JavaXMIFactoryImpl.java,v $ - * $Revision: 1.8 $ $Date: 2005/09/14 23:30:35 $ - */ -import java.io.IOException; -import java.util.*; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMIResource; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; -import org.eclipse.jem.java.JavaPackage; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jem.java.adapters.*; -import org.eclipse.jem.java.internal.impl.JavaFactoryImpl; - -/** - * Factory to create the Resource for the Java protocol. - * - * It allows extensions to the reflection key to be registered with it. - * - * Creation date: (10/4/2000 8:22:23 AM) - * @author: Administrator - */ -public class JavaXMIFactoryImpl extends XMIResourceFactoryImpl implements JavaXMIFactory { - private static final String SCHEMA_SEPERATOR = ":/"; //$NON-NLS-1$ - protected List extensions = new ArrayList(); - - /** - * JavaXMIFactoryImpl constructor comment. - */ - public JavaXMIFactoryImpl() { - super(); - } - - - public void registerReflectionKeyExtension(IJavaReflectionKeyExtension extension) { - extensions.add(extension); - } - - - public void deregisterReflectionKeyExtension(IJavaReflectionKeyExtension extension) { - extensions.remove(extension); - } - - protected void createJavaPackage(String packageName, String xmiuri, Resource resource) { - // changed to allow a zero-length package name - // for the special case of "java:/#int", etc. - JavaRefFactory jfac = JavaRefFactory.eINSTANCE; - JavaPackage pack = jfac.createJavaPackage(); - // Need to create and add special JavaFactory for instantiation to work. - JavaFactoryImpl fact = new JavaFactoryImpl(); - pack.setEFactoryInstance(fact); - if (packageName.length() > 0) { - // Standard Java package - pack.setNsPrefix(packageName); - pack.setName(packageName); - } else { - // Primitive package - pack.setNsPrefix(JavaPackage.PRIMITIVE_PACKAGE_NAME); - pack.setName(JavaPackage.PRIMITIVE_PACKAGE_NAME); - } - - pack.setNsURI(xmiuri); - resource.getContents().add(pack); - ((XMIResource) pack.eResource()).setID(pack, JavaPackage.PACKAGE_ID); - } - public static class JavaXMIResource extends XMIResourceImpl { - protected IJavaReflectionKey reflectionKey; - - public JavaXMIResource(URI uri) { - super(uri); - } - - public void setReflectionKey(IJavaReflectionKey key) { - reflectionKey = key; - } - - public void load(Map options) throws IOException { - try { - super.load(options); - } catch (Exception exception) { - } - } - - public EObject getEObject(String uriFragment) { - EObject result = super.getEObject(uriFragment); - if (result == null && reflectionKey != null) { - result = (EObject) reflectionKey.get(uriFragment); - } - return result; - } - - /** - * Used by JavaReflectionKey to look directly into ID table to bypass an infinite loop. It will - * call here because it may not of first been found, but then added, so now is found. - * - * @param uriFragment - * @return - * - * @since 1.1.0 - */ - EObject primGetEObject(String uriFragment) { - return super.getEObject(uriFragment); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#useIDAttributes() - */ - protected boolean useIDAttributes() { - return false; - } - - } - - public Resource createResource(URI uri) { - JavaXMIResource resource = new JavaXMIResource(uri); - resource.setReflectionKey(new JavaReflectionKey(extensions, resource)); - - String uriString = uri.toString(); - createJavaPackage(stripScheme(uriString), uriString, resource); - - return resource; - } - - public static void register() { - Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(JavaXMIFactory.SCHEME, JavaXMIFactory.INSTANCE); - } - - /** - * Strip the trailing identifier, if any, from the uri. An identifier - * begins with # or |. - */ - private String stripScheme(String uri) { - int index = uri.indexOf(SCHEMA_SEPERATOR); - if (index != -1) - return uri.substring(index + SCHEMA_SEPERATOR.length(), uri.length()); - else - return uri; - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReadAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReadAdaptor.java deleted file mode 100644 index e6f02d9d4..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReadAdaptor.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: ReadAdaptor.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:25 $ - */ - -import org.eclipse.emf.ecore.EObject; -/** - * Extended Adaptor interface which adds support for an adapter - * providing default values for attributes. - * Creation date: (6/6/2000 4:41:19 PM) - * @author: Scott Rich - */ -public interface ReadAdaptor extends org.eclipse.emf.common.notify.Adapter { - public static final String TYPE_KEY = "JavaReflection"; //$NON-NLS-1$ - public Object getValueIn(EObject object, EObject attribute); - public boolean reflectValuesIfNecessary(); //FB -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java deleted file mode 100644 index e9df6b021..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/ReflectionAdaptor.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters; -/* - * $RCSfile: ReflectionAdaptor.java,v $ - * $Revision: 1.14 $ $Date: 2006/05/17 20:13:07 $ - */ -import java.util.logging.Level; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.*; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.EcoreUtil; - - -import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler; -import org.eclipse.jem.util.logger.proxy.Logger; -/** - * ReflectionAdaptor - a read adaptor base implementation which does a bulk - * load of relflected values on the first request. - * Subclasses can optimize to defer some properties. - * Properties may also be deferred by setting their values with proxy references, - * for example, for supertype and other referenced types. - * Creation date: (6/6/2000 4:42:50 PM) - * @author: Administrator - */ -public abstract class ReflectionAdaptor extends org.eclipse.emf.common.notify.impl.AdapterImpl implements ReadAdaptor { - public static final char C_CLASS_MEMBER_DELIMITER = '.'; - public static final char C_METHOD_PARM_DELIMITER = '('; - public static final char C_METHODID_PARMID_DELIMITER = '-'; - public static final char C_PARM_PARM_DELIMITER = ','; - public static final char PATH_DELIMITER = '/'; - // SW id contains & in xml file casues exception throw during load - // public static final String S_CONSTRUCTOR_TOKEN = "&V";//$NON-NLS-1$ - public static final String S_CONSTRUCTOR_TOKEN = "_V";//$NON-NLS-1$ // SW - // cache a static empty String[] for no parm methods - protected static String[] emptyStringArray = new String[0]; - - - /** - * Notification event type for special Reflection notifications. This will be the event type for the special ones, like REFLECTION_EVENT. - * The listener should listen for this event type, and then check the feature for the type of special event (like REFLECTION_EVENT). - * @since 1.1.0 - */ - public static final int EVENT = -3456; // Using a funny number to try to eliminate confliction with any other specials that may of occur from other code on the JavaClass. - - /** - * Special notification event type. This is sent against a JavaClass (as the target) whenever reflection occurs. It will be - * sent under the notification event type of REFLECTION_EVENT. - * @since 1.1.0 - */ - public static final EAttribute REFLECTION_EVENT = EcoreFactory.eINSTANCE.createEAttribute(); - - /* - * Fill in the name. Not really needed but it would be nice. - */ - static {REFLECTION_EVENT.setName("reflectValues");} //$NON-NLS-1$ - - protected boolean hasReflected = false; - protected boolean isReflecting = false; -public ReflectionAdaptor() { - super(); -} -public ReflectionAdaptor(Notifier target) { - super(); - setTarget(target); -} -/** - * Helper method to ensure full initialization of the target. Required - * for serialization. - */ -public static void forceDeferredReadFor(EObject target) { - ReflectionAdaptor adaptor = retrieveAdaptorFrom(target); - if (adaptor != null) { - adaptor.reflectValuesIfNecessary(); - } -} -protected Resource getTargetResource() { - if (getTarget() != null) - return ((org.eclipse.emf.ecore.EObject) getTarget()).eResource(); - return null; -} -/** - * Helper method to fetch the adaptor from the object, and if it exists, get the adapted - * value for the attribute. Overloaded for many-sided attributes where the return value would - * otherwise be an enumeration; in this case will return an Array instead. - */ -public static Object getValue(EObject object, EReference attribute) { -//FB ReflectionAdaptor adaptor = retrieveAdaptorFrom(object); -//FB if (adaptor != null) -//FB return adaptor.getValueIn(object, attribute); -//FB return ((IReadAdaptable) object).primRefValue(attribute); - return object.eGet(attribute); //FB - -} -/*Helper method to fetch the adaptor from the object, and if it exists, get the adapted - *value for the attribute. - */ -public static Object getValue(EObject object, EObject attribute) { -//FB ReflectionAdaptor adaptor = retrieveAdaptorFrom(object); -//FB if (adaptor != null) -//FB return adaptor.getValueIn(object, attribute); -//FB return ((IReadAdaptable) object).primRefValue(attribute); - return object.eGet((EStructuralFeature)attribute); //FB -} -/** - * getValueIn method comment. - */ -public Object getValueIn(EObject object, EObject attribute) { -//FB reflectValuesIfNecessary(); -//FB return ((IReadAdaptable) object).primRefValue(attribute); - return object.eGet((EStructuralFeature)attribute); //FB -} -/** - * isAdaptorForType method comment. - */ -public boolean isAdapterForType(Object type) { - return (type == ReadAdaptor.TYPE_KEY); -} -/** - * reflectValues - template method, subclasses override to pump values into target - */ -public abstract boolean reflectValues(); -/** - * Return a boolean indicating whether reflection had occurred. - */ -public synchronized boolean reflectValuesIfNecessary() { - if (!hasReflected && !isReflecting) { - try { - isReflecting = true; - EObject etarget = (EObject)getTarget(); - if (!etarget.eIsProxy() && etarget.eResource() != null && etarget.eResource().getResourceSet() != null) - hasReflected = reflectValues(); - else - hasReflected = false; // AS long we are a proxy or is not in a valid resource or set, we won't reflect. - } catch (Throwable e) { - hasReflected = false; - Logger logger = Logger.getLogger(); - if (logger.isLoggingLevel(Level.WARNING)) { - logger.log(ResourceHandler.getString("Failed_reflecting_values_ERROR_"), Level.WARNING); //$NON-NLS-1$ = "Failed reflecting values!!!" - logger.logWarning(e); - } - } finally { - isReflecting = false; - getTarget().eNotify(new ENotificationImpl((InternalEObject)getTarget(), EVENT, REFLECTION_EVENT, null, null, Notification.NO_INDEX)); - } - } - return hasReflected; -} -public static ReflectionAdaptor retrieveAdaptorFrom(EObject object) { - synchronized (object) { - return (ReflectionAdaptor)EcoreUtil.getRegisteredAdapter(object, ReadAdaptor.TYPE_KEY); - } -} -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JDKAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JDKAdaptor.java deleted file mode 100644 index 6e423e81e..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JDKAdaptor.java +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters.jdk; -/* - * $RCSfile: JDKAdaptor.java,v $ - * $Revision: 1.7 $ $Date: 2005/08/24 20:20:25 $ - */ - -import java.lang.reflect.Array; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.xmi.XMIResource; -import org.eclipse.jem.java.*; -import org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor; -/** - * Insert the type's description here. - * Creation date: (6/6/2000 4:42:50 PM) - * @author: Administrator - */ -public abstract class JDKAdaptor extends JavaReflectionAdaptor { - public JavaJDKAdapterFactory adapterFactory; - public JDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) { - super(target); - setAdapterFactory(anAdapterFactory); - } - /** - * computeMethodID - generate the unique ID to be used to identify a constructor. - * Similar to a Signature, but hopefully more readable. - * The name format will be: - * simpleClassName.simpleClassName(com.fronk.ParmType1_parmType2&V - * Note: This implementation is tightly coupled with ReflectionAdapter.getTypeNamesFromMethodID(). - * - * It has to be done separately for JDK because Constructors and Methods are different classes. - * However, in the Java Model they are both just Methods with a flag indicating Constructor. - */ - public static String computeMethodID(java.lang.reflect.Constructor jdkConstructor) { - StringBuffer out = new StringBuffer(); - String className = getSimpleName(jdkConstructor.getDeclaringClass().getName()); - out.append(className); - out.append(C_CLASS_MEMBER_DELIMITER); - out.append(computeMethodName(jdkConstructor)); - out.append(C_METHOD_PARM_DELIMITER); - Class[] parmTypes = jdkConstructor.getParameterTypes(); - for (int i = 0; i < parmTypes.length; i++) { - out.append(parmTypes[i].getName()); - if (i < parmTypes.length - 1) - out.append(C_PARM_PARM_DELIMITER); - } - out.append(S_CONSTRUCTOR_TOKEN); //It's a constructor - return out.toString(); - } - /** - * computeMethodID - generate the unique ID to be used to identify a method. - * Similar to a Signature, but hopefully more readable. - * If there are no parms, it will end with a "(" so that it can be distictive from a field. - * The name format will be: - * simpleClassName.methodName(com.fronk.ParmType1_parmType2 - * Note: This implementation is tightly coupled with ReflectionAdapter.getTypeNamesFromMethodID(). - */ - public static String computeMethodID(java.lang.reflect.Method jdkMethod) { - StringBuffer out = new StringBuffer(); - String className = getSimpleName(jdkMethod.getDeclaringClass().getName()); - out.append(className); - out.append(C_CLASS_MEMBER_DELIMITER); - out.append(computeMethodName(jdkMethod)); - out.append(C_METHOD_PARM_DELIMITER); - Class[] parmTypes = jdkMethod.getParameterTypes(); - for (int i = 0; i < parmTypes.length; i++) { - out.append(parmTypes[i].getName()); - if (i < parmTypes.length - 1) - out.append(C_PARM_PARM_DELIMITER); - } - if (jdkMethod.getDeclaringClass().getName().equals(jdkMethod.getName())) - out.append(S_CONSTRUCTOR_TOKEN); //It's a constructor - return out.toString(); - } - /** - * computeMethodName - generate the name to be used to identify a constructor. - * For the moment, names are simple, and UUID's are complex. - * - * It has to be done separately for JDK because Constructors and Methods are different classes. - * However, in the Java Model they are both just Methods with a flag indicating Constructor. - */ - public static String computeMethodName(java.lang.reflect.Constructor jdkConstructor) { - return getSimpleName(jdkConstructor.getName()); // CTOR names come back fully-qualified with package. - } - /** - * computeMethodName - generate the name to be used to identify a method. - * For the moment, names are simple, and UUID's are complex. - */ - public static String computeMethodName(java.lang.reflect.Method jdkMethod) { - return jdkMethod.getName(); - } - /** - * createJavaField - instantiate a Java Field based on the passed Field - * We are deferring field contents assuming that its adaptor will reflect its details. - */ - public Field createJavaField(java.lang.reflect.Field reflectedField, XMIResource resource) { - Field newField = getJavaFactory().createField(); - newField.setName(reflectedField.getName()); - String className = getSimpleName(reflectedField.getDeclaringClass().getName()); - resource.setID(newField, className + C_CLASS_MEMBER_DELIMITER + reflectedField.getName()); - return newField; - } - /** - * createJavaMethod - instantiate a Java Method based on the passed Java Reflection Constructor - * We are deferring method contents assuming that its adaptor will reflect its details. - * We need to store enough info in the empty Method to find its Java source. - * The ID will eventually hold enough info to identify the source, so we use it. - */ - public Method createJavaMethod(java.lang.reflect.Constructor jdkConstructor, XMIResource resource) { - Method newMethod = getJavaFactory().createMethod(); - // We use a simple name, but a complex ID - newMethod.setName(computeMethodName(jdkConstructor)); - resource.setID(newMethod, computeMethodID(jdkConstructor)); - return newMethod; - } - /** - * createJavaMethod - instantiate a Java Method based on the passed Java Reflection Method - * We are deferring method contents assuming that its adaptor will reflect its details. - * We need to store enough info in the empty Method to find its Java source. - * The ID will eventually hold enough info to identify the source, so we use it. - */ - public Method createJavaMethod(java.lang.reflect.Method jdkMethod, XMIResource resource) { - Method newMethod = getJavaFactory().createMethod(); - // We use a simple name, but a complex ID - newMethod.setName(computeMethodName(jdkMethod)); - resource.setID(newMethod, computeMethodID(jdkMethod)); - return newMethod; - } - /** - * Insert the method's description here. - * Creation date: (11/07/00 3:43:55 PM) - * @return org.eclipse.jem.java.adapters.JavaJDKAdapterFactory - */ - public JavaJDKAdapterFactory getAdapterFactory() { - return adapterFactory; - } - public ClassLoader getAlternateClassLoader() { - return getAdapterFactory().getContextClassLoader(); - } - /***************************************************************************** - * Method to convert the textual form of a primitive type into its Class object - * - * @param type The primitive type's textual representation - */ - public static Class getPrimitiveType(String type) { - Class c = null; - - if (type.equals(byte.class.getName())) { - c = byte.class; - } else if (type.equals(short.class.getName())) { - c = short.class; - } else if (type.equals(int.class.getName())) { - c = int.class; - } else if (type.equals(long.class.getName())) { - c = long.class; - } else if (type.equals(float.class.getName())) { - c = float.class; - } else if (type.equals(double.class.getName())) { - c = double.class; - } else if (type.equals(boolean.class.getName())) { - c = boolean.class; - } else if (type.equals(char.class.getName())) { - c = char.class; - } else if (type.equals(void.class.getName())) { - c = void.class; - } - - return c; - } - /** - * Returns the last segment of a '.'-separated qualified name. - * Returns the given name if it is not qualified. - * For example: - * <pre> - * getSimpleName("java.lang.Object") -> "Object" - * </pre> - */ - public static String getSimpleName(String name) { - int lastDot = name.lastIndexOf('.'); - if (lastDot == -1) - return name; - return name.substring(lastDot + 1); - } - public Class getType(JavaHelpers modelClass) { - Class result = null; - if (modelClass.isArray()) { - ArrayType arrayType = (ArrayType) modelClass; - Class componentClass = getType(arrayType.getFinalComponentType()); - result = (Array.newInstance(componentClass, new int[arrayType.getArrayDimensions()])).getClass(); - } else if (modelClass.isPrimitive()) { - result = getType(modelClass.getQualifiedName()); - } else { - result = getType(((JavaClass) modelClass).getQualifiedNameForReflection()); - } - return result; - } - public Class getType(String qualifiedName) { - // Try for a primitive type ("int","char",etc.) first - Class primType = getPrimitiveType(qualifiedName); - if (primType == null) { - // Changed for defect #212147 botp@ausaix19.austin.ibm.com@7630 system. - // - // Search only one of the following classloaders (the first one that exists) in this order. If not found - // in a classloader, it will not roll-over to another class loader. This is to avoid problems where a - // class may exist in more than one classloader. You get errors when this happens due to one class that - // was found in only one classloader that refers to another class that was found in both classloaders. - // They don't match when trying to reflect later. - // 1) Alternate classloader (if exists) - // 2) Thread context classloader (if exists) - // 3) System classloader (if exists) - // 4) Class.forName(). - if (getAlternateClassLoader() != null) { - try { - return getAlternateClassLoader().loadClass(qualifiedName); - } catch (ClassNotFoundException cnf2) { - return null; - } - } - - ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - if (contextClassLoader != null) { - try { - return contextClassLoader.loadClass(qualifiedName); - } catch (ClassNotFoundException e) { - return null; - } - } - - ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); - if (systemClassLoader != null) { - try { - return systemClassLoader.loadClass(qualifiedName); - } catch (ClassNotFoundException e) { - return null; - } - } - - try { - return Class.forName(qualifiedName); - } catch (ClassNotFoundException e) { - return null; - } - } else - return primType; - } - /* - * Utility routine to paper over array type names - * Borrowed from a package-visibility helper on java.lang.reflect.Field - */ - static String getTypeName(Class type) { - if (type.isArray()) { - try { - Class cl = type; - int dimensions = 0; - while (cl.isArray()) { - dimensions++; - cl = cl.getComponentType(); - } - StringBuffer sb = new StringBuffer(); - sb.append(cl.getName()); - for (int i = 0; i < dimensions; i++) { - sb.append("[]"); //$NON-NLS-1$ - } - return sb.toString(); - } catch (Throwable e) { /*FALLTHRU*/ - } - } - return type.getName(); - } - - /***************************************************************************** - * Method to convert the textual form of a primitive type into its Class object - * - * @param type The primitive type's textual representation - */ - public static Class primitiveForName(String type) { - Class c = null; - - if (type.equals(byte.class.getName())) { - c = byte.class; - } else if (type.equals(short.class.getName())) { - c = short.class; - } else if (type.equals(int.class.getName())) { - c = int.class; - } else if (type.equals(long.class.getName())) { - c = long.class; - } else if (type.equals(float.class.getName())) { - c = float.class; - } else if (type.equals(double.class.getName())) { - c = double.class; - } else if (type.equals(boolean.class.getName())) { - c = boolean.class; - } else if (type.equals(char.class.getName())) { - c = char.class; - } else if (type.equals(void.class.getName())) { - c = void.class; - } - - return c; - } - - /** - * Insert the method's description here. - * Creation date: (11/07/00 3:43:55 PM) - * @param newAdapterFactory org.eclipse.jem.java.adapters.JavaJDKAdapterFactory - */ - public void setAdapterFactory(JavaJDKAdapterFactory newAdapterFactory) { - adapterFactory = newAdapterFactory; - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java deleted file mode 100644 index 241b69fa0..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaClassJDKAdaptor.java +++ /dev/null @@ -1,354 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaClassJDKAdaptor.java,v $ - * $Revision: 1.15 $ $Date: 2005/12/01 22:02:00 $ - */ - -package org.eclipse.jem.internal.java.adapters.jdk; - -import java.util.List; -import java.util.logging.Level; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.xmi.XMIResource; - -import org.eclipse.jem.internal.java.adapters.IJavaClassAdaptor; -import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler; -import org.eclipse.jem.java.*; -import org.eclipse.jem.java.internal.impl.JavaClassImpl; -import org.eclipse.jem.util.logger.proxy.Logger; - -/** - * Reflect the class using standard java.reflect methods. - * Creation date: (6/6/2000 4:42:50 PM) - * @author: Administrator - */ -public class JavaClassJDKAdaptor extends JDKAdaptor implements IJavaClassAdaptor { - - protected Class sourceType = null; - - public JavaClassJDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) { - super(target, anAdapterFactory); - } - - /** - * addFields - reflect our fields - */ - protected void addFields() { - XMIResource resource = (XMIResource) getJavaClassTarget().eResource(); - List targetFields = getJavaClassTarget().getFieldsGen(); - targetFields.clear(); - java.lang.reflect.Field[] fields = {}; - try { - fields = getSourceType().getDeclaredFields(); - } catch (NoClassDefFoundError error) { - System.out.println(ResourceHandler.getString( - "Could_Not_Reflect_Fields_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.getMessage()})); //$NON-NLS-1$ - } - for (int i = 0; i < fields.length; i++) { - targetFields.add(createJavaField(fields[i], resource)); - } - } - - /** - * addMethods - reflect our methods - */ - protected void addMethods() { - // We need to first do methods and then do constructors because the JDK treats them as two - // different objects, which the Java Model treats them as both Method's. - XMIResource resource = (XMIResource) getJavaClassTarget().eResource(); - List targetMethods = getJavaClassTarget().getMethodsGen(); - targetMethods.clear(); - java.lang.reflect.Method[] methods = {}; - try { - methods = getSourceType().getDeclaredMethods(); - } catch (NoClassDefFoundError error) { - Logger logger = Logger.getLogger(); - if (logger.isLoggingLevel(Level.WARNING)) { - logger - .log( - ResourceHandler - .getString( - "Could_Not_Reflect_Methods_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.toString()}), Level.WARNING); //$NON-NLS-1$ - } - } - for (int i = 0; i < methods.length; i++) { - targetMethods.add(createJavaMethod(methods[i], resource)); - } - - // Now do the constructors - java.lang.reflect.Constructor[] ctors = {}; - try { - ctors = getSourceType().getDeclaredConstructors(); - } catch (NoClassDefFoundError error) { - Logger logger = Logger.getLogger(); - if (logger.isLoggingLevel(Level.WARNING)) { - logger - .log( - ResourceHandler - .getString( - "Could_Not_Reflect_Constructors_ERROR_", new Object[] { getJavaClassTarget().getQualifiedName(), error.getMessage()}), Level.WARNING); //$NON-NLS-1$ - } - } - for (int i = 0; i < ctors.length; i++) { - targetMethods.add(createJavaMethod(ctors[i], resource)); - } - - } - - /** - * Clear the reflected fields list. - */ - protected boolean flushFields() { - getJavaClassTarget().getFieldsGen().clear(); - return true; - } - - /** - * Clear the implements list. - */ - protected boolean flushImplements() { - getJavaClassTarget().getImplementsInterfacesGen().clear(); - return true; - } - - /** - * Clear the reflected methods list. - */ - protected boolean flushMethods() { - getJavaClassTarget().getMethodsGen().clear(); - return true; - } - - protected boolean flushInnerClasses() { - getJavaClassTarget().getDeclaredClassesGen().clear(); - return true; - } - - protected boolean flushModifiers() { - JavaClass javaClassTarget = (JavaClass) getTarget(); - javaClassTarget.setAbstract(false); - javaClassTarget.setFinal(false); - javaClassTarget.setPublic(false); - javaClassTarget.setKind(TypeKind.UNDEFINED_LITERAL); - return true; - } - - /** - * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#flushReflectedValues(boolean) - */ - protected boolean flushReflectedValues(boolean clearCachedModelObject) { - boolean result = flushModifiers(); - result &= flushSuper(); - result &= flushImplements(); - result &= flushMethods(); - result &= flushFields(); - result &= flushInnerClasses(); - return result; - } - - /** - * @see org.eclipse.jem.java.adapters.JavaReflectionAdaptor#postFlushReflectedValuesIfNecessary() - */ - protected void postFlushReflectedValuesIfNecessary(boolean isExisting) { - getJavaClassTarget().setReflected(false); - super.postFlushReflectedValuesIfNecessary(isExisting); - } - - /** - * Set the supertype to be null. - */ - protected boolean flushSuper() { - List targetSupers = getJavaClassTarget().primGetESuperTypes(); - targetSupers.clear(); - return true; - } - - /** - * Return the target typed to a JavaClass. - */ - protected JavaClassImpl getJavaClassTarget() { - return (JavaClassImpl) getTarget(); - } - - public Object getReflectionSource() { - return getSourceType(); - } - /* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#hasReflectionSource() - */ - public boolean hasCachedReflectionSource() { - return sourceType != null; - } - - /** - * getSourceType - return the java.lang.Class which describes our existing Java class - */ - protected Class getSourceType() { - if (sourceType == null) { - sourceType = getType((JavaClass) getTarget()); - } - return sourceType; - } - - /** - * getValueIn method comment. - */ - public Object getValueIn(EObject object, EObject attribute) { - // At this point, this adapter does not dynamically compute any values, - // all values are pushed back into the target on the initial call. - return super.getValueIn(object, attribute); - } - - /** - * Return true if the sourceType is null or if it is a binary type. Reflection from the JDK is always from binary. - */ - public boolean isSourceTypeFromBinary() { - return true; - } - - /** - * reflectValues - template method, subclasses override to pump values into target. on entry: name, containing package (and qualified name), and - * document must be set. Return true if successful JavaClass adaptor: - set modifiers - set name - set reference to super - create methods - - * create fields - add imports - */ - public boolean reflectValues() { - super.reflectValues(); - try { - if (getSourceType() != null) { - setModifiers(); - setNaming(); - try { - setSuper(); - } catch (InheritanceCycleException e) { - Logger.getLogger().log(e); - } - setImplements(); - addMethods(); - addFields(); - reflectInnerClasses(); - setDeclaringClass(); - getAdapterFactory().registerReflection(getSourceType().getName(), this); - // addImports(); - return true; - } - return false; - } finally { - //Don't cache the class beyond the operation of reflect values; - //this enables dynamic swapping of the alternate class loader - //for java reflection, as well as avoids potential memory leakage - sourceType = null; - } - } - - protected void setDeclaringClass() { - Class declaringType = getSourceType().getDeclaringClass(); - if (declaringType != null) { - // Need to get it and reflect it so that the declared type of this target is set correctly. We can just - // set it ourselves directly because ECore would try to add it to the list of inner classes of the declaring type. This - // would cause it to be added twice, once from the reflection caused by the inverse setting, and once from our doing - // the inverse setting itself. - ResourceSet set = getTargetResource().getResourceSet(); - JavaClassImpl declaringClass = (JavaClassImpl) JavaRefFactory.eINSTANCE.reflectType(declaringType.getName(), set); - declaringClass.getDeclaredClasses(); // This will cause it to put us into its list and also set our declaring class to this declaring type. - } - } - - /** - * - */ - protected void reflectInnerClasses() { - Class[] innerClasses = getSourceType().getClasses(); - if (innerClasses.length != 0) { - List declaredClasses = getJavaClassTarget().getDeclaredClassesGen(); - JavaClass inner; - ResourceSet set = getTargetResource().getResourceSet(); - for (int i = 0; i < innerClasses.length; i++) { - inner = (JavaClass) JavaRefFactory.eINSTANCE.reflectType(innerClasses[i].getName(), set); - declaredClasses.add(inner); - } - } - - } - - /** - * setImplements - set our implemented/super interfaces here For an interface, these are superclasses. For a class, these are implemented - * interfaces. - */ - protected void setImplements() { - Class[] interfaces = getSourceType().getInterfaces(); - // needs work, the names above will be simple names if we are relfecting from a source file - JavaClassImpl javaClassTarget = (JavaClassImpl) getTarget(); - JavaClass ref; - List intList = javaClassTarget.getImplementsInterfacesGen(); - intList.clear(); - for (int i = 0; i < interfaces.length; i++) { - ref = createJavaClassRef(interfaces[i].getName()); - intList.add(ref); - } - } - - /** - * setModifiers - set the attribute values related to modifiers here - */ - protected void setModifiers() { - JavaClass javaClassTarget = (JavaClass) getTarget(); - javaClassTarget.setAbstract(java.lang.reflect.Modifier.isAbstract(getSourceType().getModifiers())); - javaClassTarget.setFinal(java.lang.reflect.Modifier.isFinal(getSourceType().getModifiers())); - javaClassTarget.setPublic(java.lang.reflect.Modifier.isPublic(getSourceType().getModifiers())); - // Set type to class or interface, not yet handling EXCEPTION - if (getSourceType().isInterface()) - javaClassTarget.setKind(TypeKind.INTERFACE_LITERAL); - else - javaClassTarget.setKind(TypeKind.CLASS_LITERAL); - } - - /** - * setNaming - set the naming values here - qualified name (package name + name) must be set first, that is the path to the real Java class - ID - - * simple name, identity within a package document - NO UUID!!! - */ - protected void setNaming() { - // JavaClass javaClassTarget = (JavaClass) getTarget(); - // javaClassTarget.refSetUUID((String) null); - // ((XMIResource)javaClassTarget.eResource()).setID(javaClassTarget,getSimpleName(getSourceType().getName())); - } - - /** - * setSuper - set our supertype here, implemented interface are handled separately - */ - protected void setSuper() throws InheritanceCycleException { - Class superClass = null; - superClass = getSourceType().getSuperclass(); - if (superClass != null) { - JavaClass javaClassTarget = (JavaClass) getTarget(); - javaClassTarget.setSupertype(createJavaClassRef(superClass.getName())); - } - } - - /** - * Return true if the sourceType can be found. - */ - public boolean sourceTypeExists() { - return getSourceType() != null; - } - - public boolean reflectFieldsIfNecessary() { - return reflectValuesIfNecessary(); - } - - public boolean reflectMethodsIfNecessary() { - return reflectValuesIfNecessary(); - } -} - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaFieldJDKAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaFieldJDKAdaptor.java deleted file mode 100644 index fafa6c5b3..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaFieldJDKAdaptor.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters.jdk; -/* - * $RCSfile: JavaFieldJDKAdaptor.java,v $ - * $Revision: 1.7 $ $Date: 2005/08/24 20:20:25 $ - */ -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jem.java.*; -import org.eclipse.jem.internal.java.adapters.ReadAdaptor; -/** - * Insert the type's description here. - * Creation date: (6/6/2000 4:42:50 PM) - * @author: Administrator - */ -public class JavaFieldJDKAdaptor extends JDKAdaptor { - protected java.lang.reflect.Field sourceField = null; - protected Class parentType = null; - public JavaFieldJDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) { - super(target, anAdapterFactory); - } - /** - * getParentType - return the Class which corresponds to our parent JavaClass - * we're going to do this a lot, so cache it. - */ - protected Class getParentType() { - if (parentType == null) { - Field targetField = (Field) getTarget(); - JavaClass parentJavaClass = targetField.getJavaClass(); - JavaClassJDKAdaptor pa = (JavaClassJDKAdaptor) EcoreUtil.getAdapter(parentJavaClass.eAdapters(), ReadAdaptor.TYPE_KEY); - if (pa != null) - parentType = pa.getSourceType(); - } - return parentType; - } - public Object getReflectionSource() { - return getSourceField(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#hasReflectionSource() - */ - public boolean hasCachedReflectionSource() { - return sourceField != null; - } - /** - * getSourceField - return the java.lang.reflect.Field which describes our implementing field - */ - protected java.lang.reflect.Field getSourceField() { - if (sourceField == null) { - Class parent = this.getParentType(); - if (parent != null) { - try { - sourceField = parent.getDeclaredField(((Field) getTarget()).getName()); - } catch (NoSuchFieldException e) { - // OK, carry on - } - } - } - return sourceField; - } - public Field getTargetField() { - return (Field) getTarget(); - } - /** - * getValueIn method comment. - */ - public Object getValueIn(EObject object, EObject attribute) { - // At this point, this adapter does not dynamically compute any values, - // all values are pushed back into the target on the initial call. - return super.getValueIn(object, attribute); - } - /** - * reflectValues - template method, subclasses override to pump values into target. - * on entry: name, containing package (and qualified name), and document must be set. - * JavaClass adaptor: - * - set modifiers - * - set name - * - set type - */ - public boolean reflectValues() { - if (getSourceField() != null) { - setModifiers(); - setType(); - setInitializerIfPossible(); - return true; - } - return false; - } - /** - * Used for the very narrow case of final static Strings - */ - protected void setInitializerIfPossible() { - if (!(getTargetField().isStatic() && getTargetField().isFinal() && "java.lang.String".equals(((JavaHelpers) getTargetField().getEType()).getQualifiedName()))) //$NON-NLS-1$ - return; - - String value = null; - try { - value = (String) getSourceField().get(null); - } catch (IllegalAccessException ex) { - return; - } - - if (value == null) - return; - else - value = "\"".concat(value).concat("\""); //$NON-NLS-2$//$NON-NLS-1$ - - Block aBlock = createBlock(getTargetField().getName(), value); - getTargetField().setInitializer(aBlock); - } - /** - * setModifiers - set the attribute values related to modifiers here - */ - protected void setModifiers() { - Field javaFieldTarget = (Field) getTarget(); - // For JDK reflection, I don't think we can set the initializer - int modifiers = getSourceField().getModifiers(); - javaFieldTarget.setStatic(java.lang.reflect.Modifier.isStatic(modifiers)); - javaFieldTarget.setTransient(java.lang.reflect.Modifier.isTransient(modifiers)); - javaFieldTarget.setVolatile(java.lang.reflect.Modifier.isVolatile(modifiers)); - javaFieldTarget.setFinal(java.lang.reflect.Modifier.isFinal(modifiers)); - // Set visibility - if (java.lang.reflect.Modifier.isPublic(modifiers)) - javaFieldTarget.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL); - else if (java.lang.reflect.Modifier.isPrivate(modifiers)) - javaFieldTarget.setJavaVisibility(JavaVisibilityKind.PRIVATE_LITERAL); - else if (java.lang.reflect.Modifier.isProtected(modifiers)) - javaFieldTarget.setJavaVisibility(JavaVisibilityKind.PROTECTED_LITERAL); - else - javaFieldTarget.setJavaVisibility(JavaVisibilityKind.PACKAGE_LITERAL); - } - /** - * setType - set our type here - */ - protected void setType() { - String typeName = getTypeName(getSourceField().getType()); - setFieldType(getTargetField(), typeName); - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaJDKAdapterFactory.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaJDKAdapterFactory.java deleted file mode 100644 index bf0b5e47c..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaJDKAdapterFactory.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters.jdk; -/* - * $RCSfile: JavaJDKAdapterFactory.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:25 $ - */ -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.jem.internal.java.adapters.JavaReflectionAdapterFactory; -import org.eclipse.jem.internal.java.adapters.ReflectionAdaptor; -/** - * Insert the type's description here. - * Creation date: (6/13/2000 1:20:31 PM) - * @author: Administrator - */ -public class JavaJDKAdapterFactory extends JavaReflectionAdapterFactory { - protected ClassLoader contextClassLoader; - /** - * JavaJDOMAdapterFactory constructor comment. - */ - public JavaJDKAdapterFactory() { - super(); - //adapterKey = TYPE_NAME; - } - /** - * JavaJDOMAdapterFactory constructor comment. - */ - public JavaJDKAdapterFactory(ClassLoader aClassLoader) { - this(); - setContextClassLoader(aClassLoader); - } - protected ReflectionAdaptor createJavaClassAdaptor(Notifier target) { - return new JavaClassJDKAdaptor(target, this); - } - protected ReflectionAdaptor createJavaFieldAdaptor(Notifier target) { - return new JavaFieldJDKAdaptor(target, this); - } - protected ReflectionAdaptor createJavaMethodAdaptor(Notifier target) { - return new JavaMethodJDKAdaptor(target, this); - } - // Flush ALL adapters, worst case - public void flushAll() { - isBusyIteratingReflected = true; - try { - Iterator i = reflected.values().iterator(); - while (i.hasNext()) - ((JavaClassJDKAdaptor) i.next()).flushReflectedValuesIfNecessary(); - } finally { - finishedIteratingReflected(); - } - } - // Flush the adapter for a source object - public void flushReflection(String source) { - JavaClassJDKAdaptor a = (JavaClassJDKAdaptor) reflected.get(source); - if (a != null) - a.flushReflectedValuesIfNecessary(); - } - /** - * Insert the method's description here. - * Creation date: (11/07/00 3:38:12 PM) - * @return java.lang.ClassLoader - */ - public java.lang.ClassLoader getContextClassLoader() { - return contextClassLoader; - } - /** - * Insert the method's description here. - * Creation date: (11/07/00 3:38:12 PM) - * @param newContextClassLoader java.lang.ClassLoader - */ - public void setContextClassLoader(java.lang.ClassLoader newContextClassLoader) { - contextClassLoader = newContextClassLoader; - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaMethodJDKAdaptor.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaMethodJDKAdaptor.java deleted file mode 100644 index f922fa0f2..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/jdk/JavaMethodJDKAdaptor.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters.jdk; -/* - * $RCSfile: JavaMethodJDKAdaptor.java,v $ - * $Revision: 1.9 $ $Date: 2005/09/14 23:30:35 $ - */ - -import java.util.List; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.xmi.XMIResource; -import org.eclipse.jem.java.*; -import org.eclipse.jem.internal.java.adapters.IJavaMethodAdapter; -import org.eclipse.jem.internal.java.adapters.ReadAdaptor; -import org.eclipse.jem.java.internal.impl.MethodImpl; -/** - * Insert the type's description here. - * Creation date: (6/6/2000 4:42:50 PM) - * @author: Administrator - */ -public class JavaMethodJDKAdaptor extends JDKAdaptor implements IJavaMethodAdapter { - protected java.lang.reflect.AccessibleObject sourceAccessible = null; // Could be method or ctor. - protected Class parentType = null; - // cache a static empty Class[] for no parm methods - protected static Class[] emptyClassArray = new Class[0]; - // cache a static empty String[], too - protected static String[] emptyStringArray = new String[0]; - public JavaMethodJDKAdaptor(Notifier target, JavaJDKAdapterFactory anAdapterFactory) { - super(target, anAdapterFactory); - } - /** - * addExceptions - reflect our exception list - */ - protected void addExceptions() { - Class[] exceptions = - (getSourceAccessible() instanceof java.lang.reflect.Method) - ? ((java.lang.reflect.Method) getSourceAccessible()).getExceptionTypes() - : ((java.lang.reflect.Constructor) getSourceAccessible()).getExceptionTypes(); - // EList exList = (EList) javaMethodTarget.primRefValue(JavaRefPackage.eINSTANCE.getMethod_JavaExceptions()); - List exList = getMethodTarget().getJavaExceptionsGen(); - for (int i = 0; i < exceptions.length; i++) { - exList.add(createJavaClassRef(exceptions[i].getName())); - } - } - - protected MethodImpl getMethodTarget() { - return (MethodImpl) getTarget(); - } - /** - * addParameters - reflect our parms - */ - protected void addParameters() { - Class[] parmTypes = - (getSourceAccessible() instanceof java.lang.reflect.Method) - ? ((java.lang.reflect.Method) getSourceAccessible()).getParameterTypes() - : ((java.lang.reflect.Constructor) getSourceAccessible()).getParameterTypes(); - MethodImpl javaMethodTarget = getMethodTarget(); - // List pList = (List) javaMethodTarget.primRefValue(JavaRefPackage.eINSTANCE.getMethod_Parameters()); - List pList = javaMethodTarget.getParametersGen(); - for (int i = 0; i < parmTypes.length; i++) { - pList.add(createJavaParameter(javaMethodTarget, "arg" + i, getTypeName(parmTypes[i]))); //$NON-NLS-1$ - } - } - protected JavaClass getContainingJavaClass() { - return ((Method) getTarget()).getContainingJavaClass(); - } - /** - * getParentType - return the Class which corresponds to our parent JavaClass - * we're going to do this a lot, so cache it. - */ - protected Class getParentType() { - if (parentType == null) { - Method targetMethod = (Method) getTarget(); - JavaClass parentJavaClass = targetMethod.getContainingJavaClass(); - JavaClassJDKAdaptor pa = (JavaClassJDKAdaptor) EcoreUtil.getAdapter(parentJavaClass.eAdapters(), ReadAdaptor.TYPE_KEY); - if (pa != null) - parentType = pa.getSourceType(); - } - return parentType; - } - /** - * getParmTypeSignatures - return an array of Classes for our parameter types - * For reflection purposes, we can only rely on our ID, since our parms may - * not yet be known. - */ - protected Class[] getParmTypes() { - Method javaMethodTarget = (Method) getTarget(); - String id = ((XMIResource) javaMethodTarget.eResource()).getID(javaMethodTarget); - String[] typeNames = getTypeNamesFromMethodID(id); - if (typeNames == null) - return emptyClassArray; - int n = typeNames.length; - if (n == 0) - return emptyClassArray; - Class[] types = new Class[n]; - for (int i = 0; i < n; ++i) { - types[i] = getType(typeNames[i]); - } - return types; - } - public Object getReflectionSource() { - return getSourceAccessible(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor#hasReflectionSource() - */ - public boolean hasCachedReflectionSource() { - return sourceAccessible != null; - } - /** - * getsourceMethod - return the java.lang.reflect.Method which describes our implementing method - */ - protected java.lang.reflect.AccessibleObject getSourceAccessible() { - if (sourceAccessible == null) { - Class parent = this.getParentType(); - if (parent != null) { - Class[] parmTypes = this.getParmTypes(); - try { - sourceAccessible = parent.getDeclaredMethod(((Method) getTarget()).getName(), parmTypes); - } catch (NoSuchMethodException e) { - // OK, can't reflect it - } - - if (sourceAccessible == null) { - // It wasn't a method, try for constructor. - try { - sourceAccessible = parent.getDeclaredConstructor(parmTypes); - } catch (NoSuchMethodException e) { - // OK, can't reflect it - } - } - } - } - return sourceAccessible; - } - /** - * getValueIn method comment. - */ - public Object getValueIn(EObject object, EObject attribute) { - // At this point, this adapter does not dynamically compute any values, - // all values are pushed back into the target on the initial call. - return super.getValueIn(object, attribute); - } - /** - * reflectValues - template method, subclasses override to pump values into target. - * on entry: UUID, name, containing package (and qualified name), and document must be set. - * Method adaptor: - * - set modifiers - * - set name - * - set return type - * - add parameters - * - add exceptions - */ - public boolean reflectValues() { - if (getSourceAccessible() != null) { - ((Method) getTarget()).setIsGenerated(false); - setModifiers(); - setNaming(); - setReturnType(); - addParameters(); - addExceptions(); - return true; - } - return false; - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.java.adapters.IJavaMethodAdapter#reflectGeneratedIfNecessary() - */ - public boolean reflectGeneratedIfNecessary() { - return reflectValuesIfNecessary(); - } - - public boolean reflectParamNamesIfNecessary() { - return reflectValuesIfNecessary(); - } - - /** - * setModifiers - set the attribute values related to modifiers here - */ - protected void setModifiers() { - Method methodTarget = (Method) getTarget(); - int modifiers = - (getSourceAccessible() instanceof java.lang.reflect.Method) - ? ((java.lang.reflect.Method) getSourceAccessible()).getModifiers() - : ((java.lang.reflect.Constructor) getSourceAccessible()).getModifiers(); - methodTarget.setAbstract(java.lang.reflect.Modifier.isAbstract(modifiers)); - methodTarget.setFinal(java.lang.reflect.Modifier.isFinal(modifiers)); - methodTarget.setNative(java.lang.reflect.Modifier.isNative(modifiers)); - methodTarget.setStatic(java.lang.reflect.Modifier.isStatic(modifiers)); - methodTarget.setSynchronized(java.lang.reflect.Modifier.isSynchronized(modifiers)); - methodTarget.setConstructor(getSourceAccessible() instanceof java.lang.reflect.Constructor); - // Set visibility - JavaClass javaClass = getContainingJavaClass(); - if ((javaClass.getKind() == TypeKind.INTERFACE_LITERAL) || (java.lang.reflect.Modifier.isPublic(modifiers))) - methodTarget.setJavaVisibility(JavaVisibilityKind.PUBLIC_LITERAL); - else if (java.lang.reflect.Modifier.isPrivate(modifiers)) - methodTarget.setJavaVisibility(JavaVisibilityKind.PRIVATE_LITERAL); - else if (java.lang.reflect.Modifier.isProtected(modifiers)) - methodTarget.setJavaVisibility(JavaVisibilityKind.PROTECTED_LITERAL); - else - //Visibility must be package - methodTarget.setJavaVisibility(JavaVisibilityKind.PACKAGE_LITERAL); - } - /** - * setNaming - set the naming values here - * - qualified name must be set first, that is the path to the real Java class - * - ID - * - name-based UUID - */ - protected void setNaming() { - // - // naming is currently a no-op since the name and UUID must be set prior to reflection - // ...and ID is redundant with UUID. - // javaFieldTarget.setID(parent.getQualifiedName() + "_" + javaFieldTarget.getName()); - } - /** - * setType - set our return type here - */ - protected void setReturnType() { - if (getSourceAccessible() instanceof java.lang.reflect.Method) { - Class type = ((java.lang.reflect.Method) getSourceAccessible()).getReturnType(); - Method javaMethodTarget = (Method) getTarget(); - /* - JavaParameter newParameter = createJavaParameter(javaMethodTarget, "result", getTypeName(type));//$NON-NLS-1$ - newParameter.setParameterKind(MetaJavaParameterKind.RETURN); - javaMethodTarget.getParameters().add(newParameter); - */ - javaMethodTarget.setEType(createJavaClassRef(getTypeName(type))); - } - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/nls/ResourceHandler.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/nls/ResourceHandler.java deleted file mode 100644 index 11ef6dd78..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/adapters/nls/ResourceHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.adapters.nls; -/* - * $RCSfile: ResourceHandler.java,v $ - * $Revision: 1.3 $ $Date: 2005/08/24 20:20:25 $ - */ -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.text.MessageFormat; - -public class ResourceHandler { - - private static ResourceBundle fgResourceBundle; - - /** - * Returns the resource bundle used by all classes in this Project - */ - public static ResourceBundle getResourceBundle() { - try { - return ResourceBundle.getBundle("javaadapters");//$NON-NLS-1$ - } catch (MissingResourceException e) { - // does nothing - this method will return null and - // getString(String, String) will return the key - // it was called with - } - return null; - } - public static String getString(String key) { - if (fgResourceBundle == null) { - fgResourceBundle= getResourceBundle(); - } - - if (fgResourceBundle != null) { - try { - return fgResourceBundle.getString(key); - } catch (MissingResourceException e) { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } else { - return "!" + key + "!";//$NON-NLS-2$//$NON-NLS-1$ - } - } -public static String getString(String key, Object[] args) { - - try {return MessageFormat.format(getString(key), args);} - catch (IllegalArgumentException e) {return getString(key);} - -} -} - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/beaninfo/IIntrospectionAdapter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/beaninfo/IIntrospectionAdapter.java deleted file mode 100644 index 01ef0fc06..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/beaninfo/IIntrospectionAdapter.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.beaninfo; -/* - * $RCSfile: IIntrospectionAdapter.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:25 $ - */ -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; - - -/** - * The interface for the Beaninfo adapter. The actual implementation - * is in a separate project so that beaninfo code will not be loaded - * unless it needs to be. - */ - -public interface IIntrospectionAdapter extends org.eclipse.emf.common.notify.Adapter { - public static final Class ADAPTER_KEY = IIntrospectionAdapter.class; - public void introspectIfNecessary(); - public boolean isStale(); - public EList getEStructuralFeatures(); - public EList getEOperations(); - public BasicEList getEAllOperations(); - public EList getEvents(); - public EList getAllEvents(); - public EList getAllProperties(); -} - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/init/JavaInit.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/init/JavaInit.java deleted file mode 100644 index 8b6f1c837..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/init/JavaInit.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.init; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.internal.java.adapters.JavaXMIFactoryImpl; - -/** - * Initialize the Java Reflection mechanisms. - */ -public class JavaInit { - protected static boolean initialized = false; - protected static boolean plugin_initialized = false; - - public static void init() { - init(true); - } - - public static void init(boolean shouldPreRegisterPackages) { - if (!initialized) { - initialized = true; - if (shouldPreRegisterPackages) { - preRegisterPackages(); - setDefaultResourceFactory(); - } - //Register resource factory - JavaXMIFactoryImpl.register(); - } - } - - private static void preRegisterPackages() { - //ecore - if (!EPackage.Registry.INSTANCE.containsKey("ecore.xmi")) //$NON-NLS-1$ - EPackage.Registry.INSTANCE.put("ecore.xmi", EcorePackage.eINSTANCE); //$NON-NLS-1$ - //java - if (!EPackage.Registry.INSTANCE.containsKey("java.xmi")) //$NON-NLS-1$ - EPackage.Registry.INSTANCE.put("java.xmi", JavaRefPackage.eINSTANCE); //$NON-NLS-1$ - } - protected static void setDefaultResourceFactory() { - //This is not done outside of Eclipse - if (Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().get(Resource.Factory.Registry.DEFAULT_EXTENSION) == null) - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put( - Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMIResourceFactoryImpl()); - } - - public static void setPluginInit(boolean bPluginInit) { - // Here's where the configuration file would be read. - plugin_initialized = bPluginInit; - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandler.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandler.java deleted file mode 100644 index 96702afb8..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandler.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.instantiation; -/* - * $RCSfile: IInstantiationHandler.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:25 $ - */ -import org.eclipse.emf.ecore.*; - -import org.eclipse.jem.java.JavaDataType; - -/** - * The interface for the Instantiation handler. The actual implementation - * is in a separate project so that instantiation code will not be loaded - * unless it needs to be. - */ - -public interface IInstantiationHandler { - /** - * Answers whether the adapter handles the datatype - * or whether the standard EFactory does. - */ - public boolean handlesDataType(JavaDataType type); - - /** - * Answers whether the adapter handles the EClass or the - * standard EFactory does. - */ - public boolean handlesClass(EClass type); - - /** - * If adapterHandlesInstance returns true, then - * this method will be called to create the instance. - */ - public EObject create(EClass javaClass); - -} - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandlerFactoryAdapter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandlerFactoryAdapter.java deleted file mode 100644 index 933617705..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationHandlerFactoryAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.instantiation; -/* - * $RCSfile: IInstantiationHandlerFactoryAdapter.java,v $ - * $Revision: 1.6 $ $Date: 2005/09/14 23:30:35 $ - */ -import org.eclipse.emf.common.notify.Adapter; - -import org.eclipse.jem.java.internal.impl.JavaFactoryImpl; - -/** - * This adapter is a factory for IInstantiationHandler's. It is attached as - * an adapter on the ResourceSet that contains the java model. JavaXMIFactory - * will use it to retrieve its IInstantiationHandler. If the adapter is not - * found, then no instantiation handler exists. - */ -public interface IInstantiationHandlerFactoryAdapter extends Adapter { - - public final static Class ADAPTER_KEY = IInstantiationHandlerFactoryAdapter.class; - - /** - * Return an IInstantiationHandler. - */ - public IInstantiationHandler getInstantiationHandler(JavaFactoryImpl factory); - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationInstance.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationInstance.java deleted file mode 100644 index cdc9de990..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/internal/java/instantiation/IInstantiationInstance.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.java.instantiation; -/* - * $RCSfile: IInstantiationInstance.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:25 $ - */ -import org.eclipse.jem.java.JavaHelpers; - -/** - * The interface for an instance. The actual implementation - * is in a separate project so that instantiation code will not be loaded - * unless it needs to be. - */ -public interface IInstantiationInstance { - /** - * @return The JavaHelpers for the java type of the instance. - */ - public JavaHelpers getJavaType(); - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/ArrayType.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/ArrayType.java deleted file mode 100644 index 205a39bad..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/ArrayType.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: ArrayType.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:24 $ - */ - -import org.eclipse.emf.ecore.EClassifier; -/** - * Describes a Java Array type - * For multi-dimensional arrays, it is unlikely that the component type will be - * specified directly. This would require instantiating a chain of component types - * such as String[][][][]->String[][][]->String[][]->String[]->String. - * - * The component type relationship will be computed if the finalComponentType - * and array dimensions is specified. - * - * For this reason, the preferred way to create is through the JavaRefFactory factory method: - * createArrayType(JavaClass finalComponentType, int dimensions) - */ -public interface ArrayType extends JavaClass{ - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the ArrayDimensions attribute - */ - int getArrayDimensions(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the ArrayDimensions attribute - */ - void setArrayDimensions(int value); - - /** - * @generated This field/method will be replaced during code generation - * @return The ComponentType reference - */ - EClassifier getComponentType(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.ArrayType#getComponentType <em>Component Type</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Component Type</em>' reference. - * @see #getComponentType() - * @generated - */ - void setComponentType(EClassifier value); - - /** - * @generated This field/method will be replaced during code generation - * Get the final component type for this Array Type. - * - * In order to ensure a unique instance, we will resolve this type using - * reflection. It turns out to be most efficient to just do this by trimming the - * name. - */ - JavaHelpers getFinalComponentType(); - - /** - * @generated This field/method will be replaced during code generation - * Get the component type of this array. - * - * If this is a multi-dimensional array, the component type will be the nested - * array type. - */ - JavaHelpers getComponentTypeAsHelper(); - - /** - * @generated This field/method will be replaced during code generation - * Is this an array of java primitives - */ - boolean isPrimitiveArray(); - - /** - * @generated This field/method will be replaced during code generation - * Set the component type. - */ - void setComponentType(JavaHelpers helperComponentType); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Block.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Block.java deleted file mode 100644 index d2864c66b..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Block.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: Block.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:24 $ - */ - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -/** - * @generated - */ -public interface Block extends EObject{ - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Source attribute - */ - String getSource(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Source attribute - */ - void setSource(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Name attribute - */ - String getName(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the Name attribute - */ - void setName(String value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Contents references - */ - EList getContents(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Comment.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Comment.java deleted file mode 100644 index 73c16abf7..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Comment.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: Comment.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:24 $ - */ -package org.eclipse.jem.java; - - -/** - * @generated - */ -public interface Comment extends Block { - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Field.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Field.java deleted file mode 100644 index 0daaff4b4..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Field.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: Field.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.ecore.ETypedElement; - -/** - * @generated - */ -public interface Field extends ETypedElement{ - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsFinal attribute - */ - boolean isFinal(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#isFinal <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Final</em>' attribute. - * @see #isFinal() - * @generated - */ - void setFinal(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsStatic attribute - */ - boolean isStatic(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#isStatic <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Static</em>' attribute. - * @see #isStatic() - * @generated - */ - void setStatic(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the JavaVisibility attribute - */ - JavaVisibilityKind getJavaVisibility(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#getJavaVisibility <em>Java Visibility</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Visibility</em>' attribute. - * @see org.eclipse.jem.java.JavaVisibilityKind - * @see #getJavaVisibility() - * @generated - */ - void setJavaVisibility(JavaVisibilityKind value); - - /** - * Returns the value of the '<em><b>Transient</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Transient</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Transient</em>' attribute. - * @see #setTransient(boolean) - * @see org.eclipse.jem.java.JavaRefPackage#getField_Transient() - * @model - * @generated - */ - boolean isTransient(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#isTransient <em>Transient</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Transient</em>' attribute. - * @see #isTransient() - * @generated - */ - void setTransient(boolean value); - - /** - * Returns the value of the '<em><b>Volatile</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Volatile</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Volatile</em>' attribute. - * @see #setVolatile(boolean) - * @see org.eclipse.jem.java.JavaRefPackage#getField_Volatile() - * @model - * @generated - */ - boolean isVolatile(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#isVolatile <em>Volatile</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Volatile</em>' attribute. - * @see #isVolatile() - * @generated - */ - void setVolatile(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The JavaClass reference - */ - JavaClass getJavaClass(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#getJavaClass <em>Java Class</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Class</em>' container reference. - * @see #getJavaClass() - * @generated - */ - void setJavaClass(JavaClass value); - - /** - * @generated This field/method will be replaced during code generation - * @return The Initializer reference - */ - Block getInitializer(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Field#getInitializer <em>Initializer</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Initializer</em>' containment reference. - * @see #getInitializer() - * @generated - */ - void setInitializer(Block value); - - /** - * @generated This field/method will be replaced during code generation - * Get the class that this field is within. - */ - JavaClass getContainingJavaClass(); - - /** - * @generated This field/method will be replaced during code generation - * Is this field an array type. - */ - boolean isArray(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/InheritanceCycleException.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/InheritanceCycleException.java deleted file mode 100644 index 1c9631d36..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/InheritanceCycleException.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: InheritanceCycleException.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import java.text.MessageFormat; - -import org.eclipse.jem.internal.java.adapters.nls.ResourceHandler; - -/** - * @author DABERG - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class InheritanceCycleException extends Exception { - /** - * Comment for <code>serialVersionUID</code> - * - * @since 1.1.0 - */ - private static final long serialVersionUID = -2385690847427897656L; - private static String MSG_PATTERN = ResourceHandler.getString("Java_Inh_Cycle_ERROR_");//$NON-NLS-1$ - - /** - * - */ - public InheritanceCycleException(JavaClass aSubclass, JavaClass aSuperclass) { - this(MessageFormat.format(MSG_PATTERN, new String[]{aSubclass.getQualifiedName(), aSuperclass.getQualifiedName()})); - } - - /** - * @param s - */ - public InheritanceCycleException(String s) { - super(s); - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Initializer.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Initializer.java deleted file mode 100644 index be85f1856..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Initializer.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: Initializer.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.ecore.EObject; -/** - * @generated - */ -public interface Initializer extends EObject{ - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsStatic attribute - */ - Boolean getIsStatic(); - - /** - * @generated This field/method will be replaced during code generation - * @param value The new value of the IsStatic attribute - */ - void setIsStatic(Boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The JavaClass reference - */ - JavaClass getJavaClass(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Initializer#getJavaClass <em>Java Class</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Class</em>' container reference. - * @see #getJavaClass() - * @generated - */ - void setJavaClass(JavaClass value); - - /** - * @generated This field/method will be replaced during code generation - * @return The Source reference - */ - Block getSource(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Initializer#getSource <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source</em>' reference. - * @see #getSource() - * @generated - */ - void setSource(Block value); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaClass.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaClass.java deleted file mode 100644 index 888218467..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaClass.java +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaClass.java,v $ - * $Revision: 1.7 $ $Date: 2005/09/15 13:42:04 $ - */ -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -/** - * <!-- begin-user-doc --> - * @extends JavaHelpers - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jem.java.JavaClass#getKind <em>Kind</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#isPublic <em>Public</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#isFinal <em>Final</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getImplementsInterfaces <em>Implements Interfaces</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getClassImport <em>Class Import</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getPackageImports <em>Package Imports</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getFields <em>Fields</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getMethods <em>Methods</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getInitializers <em>Initializers</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getDeclaredClasses <em>Declared Classes</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getDeclaringClass <em>Declaring Class</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getJavaPackage <em>Java Package</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getEvents <em>Events</em>}</li> - * <li>{@link org.eclipse.jem.java.JavaClass#getAllEvents <em>All Events</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jem.java.JavaRefPackage#getJavaClass() - * @model - * @generated - */ -public interface JavaClass extends EClass, JavaHelpers{ - - public static final String DEFAULT_METHOD_NAME = "*"; - /** - * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists. It will not look up the supertype hierarchy. - */ - public Method getPublicMethodExtended(String methodName, List parameterTypes) ; - /** - * Returns a filtered list on the methods of this class, having a name equal to that of the parameter. - */ - public List getPublicMethodsExtendedNamed(String name); - - /** - * Return an array listing our Fields, including inherited fields. - * The field relationship is derived from contents. - */ - public Field[] listFieldExtended(); - /** - * Return an array listing our Methods, including inherited methods. - * The method relationship is derived from contents. - */ - public Method[] listMethodExtended(); -//FB /** -//FB * This is required for internal reflection. Do not use. -//FB */ -//FB Object primRefValue(EObject feature); - /** - * @generated This field/method will be replaced during code generation - * @return The value of the Kind attribute - */ - TypeKind getKind(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaClass#getKind <em>Kind</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Kind</em>' attribute. - * @see org.eclipse.jem.java.TypeKind - * @see #getKind() - * @generated - */ - void setKind(TypeKind value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsPublic attribute - */ - boolean isPublic(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaClass#isPublic <em>Public</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Public</em>' attribute. - * @see #isPublic() - * @generated - */ - void setPublic(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsFinal attribute - */ - boolean isFinal(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaClass#isFinal <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Final</em>' attribute. - * @see #isFinal() - * @generated - */ - void setFinal(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of ImplementsInterfaces references - */ - EList getImplementsInterfaces(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of ClassImport references - */ - EList getClassImport(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of PackageImports references - */ - EList getPackageImports(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Fields references - */ - EList getFields(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Methods references - */ - EList getMethods(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Initializers references - */ - EList getInitializers(); - - /** - * @generated This field/method will be replaced during code generation - * @return The DeclaringClass reference - */ - JavaClass getDeclaringClass(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaClass#getDeclaringClass <em>Declaring Class</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Declaring Class</em>' reference. - * @see #getDeclaringClass() - * @generated - */ - void setDeclaringClass(JavaClass value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of DeclaredClasses references - */ - EList getDeclaredClasses(); - - /** - * @generated This field/method will be replaced during code generation - * @return The JavaPackage reference - */ - JavaPackage getJavaPackage(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Events references - */ - EList getEvents(); - - /** - * Returns the value of the '<em><b>All Events</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jem.java.JavaEvent}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>All Events</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>All Events</em>' reference list. - * @see org.eclipse.jem.java.JavaRefPackage#getJavaClass_AllEvents() - * @model type="org.eclipse.jem.java.JavaEvent" transient="true" volatile="true" - * @generated - */ - EList getAllEvents(); - - /** - * @generated This field/method will be replaced during code generation - */ - boolean isNested(); - - /** - * @generated This field/method will be replaced during code generation - * Return an Field with the passed name, or null. - */ - Field getField(String fieldName); - - /** - * @generated This field/method will be replaced during code generation - * Return an Field with the passed name from this JavaClass or any supertypes. - * - * Return null if a Field named fieldName is not found. - */ - Field getFieldExtended(String fieldName); - - /** - * @generated This field/method will be replaced during code generation - * Return an Field with the passed name, or null. - */ - Field getFieldNamed(String fieldName); - - /** - * @generated This field/method will be replaced during code generation - * Return all fields, including those from supertypes. - */ - List getFieldsExtended(); - - /** - * @generated This field/method will be replaced during code generation - * Get the method of this name and these parameters. It will not look up the - * supertype hierarchy. - */ - Method getMethod(String methodName, List parameterTypes); - - /** - * @generated This field/method will be replaced during code generation - * Return a List of Strings that represent MethodElement signatures from most - * general to most specific. - */ - List getMethodElementSignatures(); - - /** - * @generated This field/method will be replaced during code generation - * Get the method of this name and these parameters. It will look up the supertype - * hierarchy. - */ - Method getMethodExtended(String methodName, List parameterTypes); - - /** - * @generated This field/method will be replaced during code generation - * Return all methods, including those from supertypes. - */ - List getMethodsExtended(); - - /** - * Return all methods, including those from supertypes excluding particular classes and methods. - * @param excludedClasses - A list of JavaClass instances to be ignored. - * @param excludedMethods - A list of Method instances to be ignored. - */ - List getMethodsExtendedWithFilters(List excludedClasses, List excludedMethods) ; - - /** - * @generated This field/method will be replaced during code generation - * Return a List of Methods that begins with @aMethodNamePrefix and is not - * included in the @excludedNames list. If @aMethodNamePrefix is null, all methods - * will be returned. - - */ - List getOnlySpecificMethods(String aMethodNamePrefix, List excludedNames); - - /** - * @generated This field/method will be replaced during code generation - * Return a method matching the name, and non-return parameters with fully - * qualified types matching all the types in the list, if it exists. It will not - * look up the supertype hierarchy. - */ - Method getPublicMethod(String methodName, List parameterTypes); - - /** - * @generated This field/method will be replaced during code generation - * Return all methods, it will not go up the supertype hierarchy. - */ - List getPublicMethods(); - - /** - * @generated This field/method will be replaced during code generation - * Return all public methods, including those from supertypes. - */ - List getPublicMethodsExtended(); - - /** - * @generated This field/method will be replaced during code generation - * Returns a filtered list on the methods of this class, having a name equal to - * that of the parameter. - */ - List getPublicMethodsNamed(String name); - - /** - * @generated This field/method will be replaced during code generation - */ - JavaClass getSupertype(); - - /** - * @generated This field/method will be replaced during code generation - * Test whether the receiver implements the passed interface (or one of its - * supertypes). - */ - boolean implementsInterface(JavaClass interfaceType); - - /** - * @generated This field/method will be replaced during code generation - * Return a string showing our details. - */ - String infoString(); - - /** - * @generated This field/method will be replaced during code generation - * Tests whether this class inherits from the passed in class. - */ - boolean inheritsFrom(JavaClass javaClass); - - /** - * @generated This field/method will be replaced during code generation - * Does this type exist. - */ - boolean isExistingType(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * Is this an interface. - * <!-- end-model-doc --> - * @model kind="operation" - * @generated - */ - boolean isInterface(); - - /** - * @generated This field/method will be replaced during code generation - * Set the supertype. - */ - void setSupertype(JavaClass javaclass) throws InheritanceCycleException; - - /** - * Return true if the passed JavaClass can be set as the supertype - * of this JavaClass. This method will test to see if aJavaClass will - * create a cycle in the inheritance structure. Return true if no - * inheritance cycle will be created. - */ - public boolean isValidSupertype(JavaClass aJavaClass) ; - - /** - * Get the EStructuralFeatures that represent the BeanInfo properties for - * just this Java class, not including inherited. It will return any EStructuralFeature - * that was specified as being at this class either through the XMI override document or - * through the BeanInfo. Structural features through the XMI may not be bean properties, - * but they are part of the features available at this class only. - * - * This is a combination of getEAttributes() and getEReferences(). - * - * To retrieve only the Bean Properties, then use Beaninfo - * Utilities.getPropertiesIterator(javaclass.getProperties()) and this will iterate over - * the Bean PropertyDecorators, and filter out the non-bean features. - * - * @return The list of properties (as EStructuralFeature's) for this java class. This list is - * not modifiable. - */ - EList getProperties(); - - /** - * Get all of the EStructuralFeatures that represent the BeanInfo properties for - * just this Java class, including inherited. It will return any EStructuralFeature - * that was specified through the XMI override document or - * through the BeanInfo. Structural features through the XMI may not be bean properties, - * but they are part of the features available. - * - * The is like getEAllStructuralFeatures() except that if BeanInfo hides any bean properties - * from the super class, this list will also hide them, while getEAllStructuralFeatures - * will not. - * - * To retrieve only the Bean Properties, then use Beaninfo - * Utilities.getPropertiesIterator(javaclass.getAllProperties()) and this will iterate over - * the Bean PropertyDecorators, and filter out the non-bean features. - * - * @return The list of all properties, including inherited, (as EStructuralFeature's) for this class. This list is - * not modifiable. - */ - EList getAllProperties(); - - - /** - * Return the reflection type, if it exists, for this class. If running within Eclipse this - * will be an {@link org.eclipse.jdt.core.IType}, or running outside of Eclipse it will be a {@link java.lang.Class}. - * - * @return IType if in Eclipse, Class if outside Eclipse, or <code>null</code> if type not found. - * - * @since 1.1.0 - */ - Object getReflectionType(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaDataType.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaDataType.java deleted file mode 100644 index 735b85824..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaDataType.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: JavaDataType.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.ecore.EClass; - -/** - * <!-- begin-user-doc --> - * @extends JavaHelpers - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jem.java.JavaRefPackage#getJavaDataType() - * @model - * @generated - */ -public interface JavaDataType extends EClass, JavaHelpers{ - - /** - * @generated This field/method will be replaced during code generation - * Return the default string representing the default value of the primitive. - */ - String getDefaultValueString(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaEvent.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaEvent.java deleted file mode 100644 index c260421af..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaEvent.java,v $ - * $Revision: 1.4 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Java Event</b></em>'. - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jem.java.JavaRefPackage#getJavaEvent() - * @model abstract="true" - * @generated - */ -public interface JavaEvent extends EStructuralFeature{ -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaHelpers.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaHelpers.java deleted file mode 100644 index 31cefaf2c..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaHelpers.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: JavaHelpers.java,v $ - * $Revision: 1.7 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -/** - * Insert the type's description here. - * Creation date: (6/27/2000 4:42:04 PM) - * @author: Administrator - */ -public interface JavaHelpers extends EClass { - static final String BOOLEAN_NAME = "java.lang.Boolean"; //$NON-NLS-1$ - static final String CHARACTER_NAME = "java.lang.Character"; //$NON-NLS-1$ - static final String BYTE_NAME = "java.lang.Byte"; //$NON-NLS-1$ - static final String DOUBLE_NAME = "java.lang.Double"; //$NON-NLS-1$ - static final String FLOAT_NAME = "java.lang.Float"; //$NON-NLS-1$ - static final String INTEGER_NAME = "java.lang.Integer"; //$NON-NLS-1$ - static final String LONG_NAME = "java.lang.Long"; //$NON-NLS-1$ - static final String SHORT_NAME = "java.lang.Short"; //$NON-NLS-1$ - static final String PRIM_BOOLEAN_NAME = "boolean"; //$NON-NLS-1$ - static final String PRIM_CHARACTER_NAME = "char"; //$NON-NLS-1$ - static final String PRIM_BYTE_NAME = "byte"; //$NON-NLS-1$ - static final String PRIM_DOUBLE_NAME = "double"; //$NON-NLS-1$ - static final String PRIM_FLOAT_NAME = "float"; //$NON-NLS-1$ - static final String PRIM_INTEGER_NAME = "int"; //$NON-NLS-1$ - static final String PRIM_LONG_NAME = "long"; //$NON-NLS-1$ - static final String PRIM_SHORT_NAME = "short"; //$NON-NLS-1$ - - static final int PRIM_NOT_ID = 0; - static final int PRIM_BOOLEAN_ID = 1; - static final int PRIM_CHARACTER_ID = 2; - static final int PRIM_BYTE_ID = 3; - static final int PRIM_DOUBLE_ID = 4; - static final int PRIM_FLOAT_ID = 5; - static final int PRIM_INTEGER_ID = 6; - static final int PRIM_LONG_ID = 7; - static final int PRIM_SHORT_ID = 8; - - /** - * Get the qualified name (with using '.' for inner classes). Will return the name if primitive too (e.g. "boolean") - * Note: This should of been get the simple name and not the qualifed name, but it is too late and has been established - * as the API. Use <code>getSimpleName()</code> instead if you want the name not qualified. - * @return the qualified name of the type. - * @see JavaHelpers#getSimpleName() - * @since 1.0.0 - */ - public String getJavaName(); - /** - * Get the simple name. This is the name of the primitive, or if a class, the name without the package. And if it is an - * inner class, it will use '.' instead of '$'. If you want the simple name for reflection (i.e. with '$') use <code>getName()</code>. - * @return the simple name (no package) of the type. - * - * @since 1.0.0 - */ - public String getSimpleName(); - - /** - * Get the primitive type that this helper wrappers or is (e.g. "java.lang.Integer" and "int" types return "int" type). If not a primitive - * or a wrapper for a primitive, then return null. - * @return - * - * @since 1.0.0 - */ - public JavaDataType getPrimitive(); - - /** - * Get the primitive id that this helper wrappers or is (e.g. "java.lang.Integer" and "int" will return {@link JavaHelpers#PRIM_INTEGER_ID}). If - * not a wrapper for a primitive then return {@link JavaHelpers#PRIM_NOT_ID}. - * @return - * - * @since 1.1.0 - */ - public int getPrimitiveID(); - /** - * To be used by people that need to get the qualified name. This would use '.' for inner classes - * and include the package name. - * @return the qualified name, including package. - * - * @since 1.0.0 - */ - public String getQualifiedName(); - public JavaClass getWrapper(); - public boolean isArray(); - /** - * Can an object of the passed in class be assigned to an - * object of this class? In other words is this class a - * supertype of the passed in class, or is it superinterface - * of it? Or in the case of primitives, are they the same. - * @param aClass - * @return <code>true</code> if assignable from the given class. - * - * @since 1.0.0 - */ - public boolean isAssignableFrom(EClassifier aClass); - public boolean isPrimitive(); - - /** - * To be used by people that need to get the qualified name used for reflection. This would use '$' instead of '.' for inner classes - * and include the package name. - * Typically bean info would need to use something like this. - * @return the qualified name, use '$' for inner classes - * - * @since 1.0.0 - */ - public String getQualifiedNameForReflection() ; -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaPackage.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaPackage.java deleted file mode 100644 index 56f71ec34..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaPackage.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaPackage.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:24 $ - */ - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EPackage; - -public interface JavaPackage extends EPackage{ - - public static final String PACKAGE_ID = "*package"; // The id (the part that goes after the '#' for a java package.) //$NON-NLS-1$ - // There will only be one package per java resource so it - // can be unique. No java types, methods, fields ids can - // start with an asterick so will be unique. - - public static final String PRIMITIVE_PACKAGE_NAME = "_-javaprim"; //$NON-NLS-1$ - /** - * @generated This field/method will be replaced during code generation - * @return The list of JavaClasses references - */ - EList getJavaClasses(); - - public String getPackageName() ; - -} //JavaPackage - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameter.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameter.java deleted file mode 100644 index 99e7a03eb..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameter.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: JavaParameter.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:24 $ - */ - -import org.eclipse.emf.ecore.EParameter; - -/** - * @generated - */ -public interface JavaParameter extends EParameter { - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsFinal attribute - */ - boolean isFinal(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaParameter#isFinal <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Final</em>' attribute. - * @see #isFinal() - * @generated - */ - void setFinal(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the ParameterKind attribute - */ - JavaParameterKind getParameterKind(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.JavaParameter#getParameterKind <em>Parameter Kind</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Parameter Kind</em>' attribute. - * @see org.eclipse.jem.java.JavaParameterKind - * @see #getParameterKind() - * @generated - */ - void setParameterKind(JavaParameterKind value); - - /** - * @generated This field/method will be replaced during code generation - * Is this parameter type an array type. - */ - boolean isArray(); - - /** - * @generated This field/method will be replaced during code generation - * Is this a return parameter. - */ - boolean isReturn(); - - /** - * @generated This field/method will be replaced during code generation - */ - JavaHelpers getJavaType(); - - /** - * @generated This field/method will be replaced during code generation - */ - String getQualifiedName(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameterKind.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameterKind.java deleted file mode 100644 index 163473784..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaParameterKind.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: JavaParameterKind.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.AbstractEnumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Java Parameter Kind</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * IN=0 - * OUT=1 - * INOUT=2 - * RETURN=3 - * <!-- end-model-doc --> - * @see org.eclipse.jem.java.JavaRefPackage#getJavaParameterKind() - * @model - * @generated - */ -public final class JavaParameterKind extends AbstractEnumerator -{ - /** - * The '<em><b>IN</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #IN_LITERAL - * @model - * @generated - * @ordered - */ - public static final int IN = 0; - /** - * The '<em><b>OUT</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #OUT_LITERAL - * @model - * @generated - * @ordered - */ - public static final int OUT = 1; - /** - * The '<em><b>INOUT</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #INOUT_LITERAL - * @model - * @generated - * @ordered - */ - public static final int INOUT = 2; - /** - * The '<em><b>RETURN</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #RETURN_LITERAL - * @model - * @generated - * @ordered - */ - public static final int RETURN = 3; - /** - * The '<em><b>IN</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>IN</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #IN - * @generated - * @ordered - */ - public static final JavaParameterKind IN_LITERAL = new JavaParameterKind(IN, "IN"); - - /** - * The '<em><b>OUT</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>OUT</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #OUT - * @generated - * @ordered - */ - public static final JavaParameterKind OUT_LITERAL = new JavaParameterKind(OUT, "OUT"); - - /** - * The '<em><b>INOUT</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>INOUT</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #INOUT - * @generated - * @ordered - */ - public static final JavaParameterKind INOUT_LITERAL = new JavaParameterKind(INOUT, "INOUT"); - - /** - * The '<em><b>RETURN</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>RETURN</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #RETURN - * @generated - * @ordered - */ - public static final JavaParameterKind RETURN_LITERAL = new JavaParameterKind(RETURN, "RETURN"); - - /** - * An array of all the '<em><b>Java Parameter Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final JavaParameterKind[] VALUES_ARRAY = - new JavaParameterKind[] { - IN_LITERAL, - OUT_LITERAL, - INOUT_LITERAL, - RETURN_LITERAL, - }; - - /** - * A public read-only list of all the '<em><b>Java Parameter Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Java Parameter Kind</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static JavaParameterKind get(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - JavaParameterKind result = VALUES_ARRAY[i]; - if (result.toString().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Java Parameter Kind</b></em>' literal with the specified value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static JavaParameterKind get(int value) { - switch (value) { - case IN: return IN_LITERAL; - case OUT: return OUT_LITERAL; - case INOUT: return INOUT_LITERAL; - case RETURN: return RETURN_LITERAL; - } - return null; - } - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private JavaParameterKind(int value, String name) { - super(value, name); - } - -} //JavaParameterKind - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefFactory.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefFactory.java deleted file mode 100644 index d492895a8..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefFactory.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: JavaRefFactory.java,v $ - * $Revision: 1.8 $ $Date: 2006/05/17 20:13:08 $ - */ - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -/** - * @generated - */ -public interface JavaRefFactory extends EFactory{ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JavaRefFactory eINSTANCE = new org.eclipse.jem.java.internal.impl.JavaRefFactoryImpl(); - - - /** - * Create a proxy reference to the class name. - * @param targetName Classname to create a proxy reference to. This must be fully-qualified. - * @return A proxy reference - * - * @since 1.0.0 - */ - public JavaClass createClassRef(String targetName); - - /** - * reflect - reflect a java type (class or primitive) for a given qualified name. - * <p>If the package or type does not exist, one will be created through - * the reflection mechanism. - * <p>Lookup the JavaClass in the context of the passed object, handling some error cases. - * @param aQualifiedName Fully qualified name of class or primitive (e.g. <code>java.lang.Object</code> or <code>int</code> - * @param relatedObject EObject that it will be related too (it will look through the resource set's project of the EObject) - * @return The type. <code>null</code> if name is not of correct format, relatedObject is not contained by a resource set, or resource set is not associated with a project. - * - * @since 1.0.0 - */ - public JavaHelpers reflectType(String aQualifiedName, EObject relatedObject); - - - /** - * reflect - reflect a java type (class or primitive) for a given qualified name. - * <p>If the package or class does not exist, one will be created through - * the reflection mechanism. - * @param aQualifiedName Fully qualified name of class or primitive (e.g. <code>java.lang.Object</code> or <code>int</code>. - * @param set Resource set to use. Its project will be used to find the type. - * @return The type. <code>null</code> if name is not of correct format, or resource set is not associated with a project. - * - * @since 1.0.0 - */ - public JavaHelpers reflectType(String aQualifiedName, ResourceSet set); - - - /** - * reflect - reflect a type for a given package name and class name. - * <p>If the package or class does not exist, one will be created through - * the reflection mechanism. - * @param aPackageName Package name - * @param aTypeName Type name - * @param set Resource set to use. Its project will be used to find the type. - * @return The type. <code>null</code> if name is not of correct format, or resource set is not associated with a project. - * - * @since 1.0.0 - */ - public JavaHelpers reflectType(String aPackageName, String aTypeName, ResourceSet set); - - /** - * reflect - reflect a Java package for a given package name. - * <p>If the package does not exist, one will be created through - * the reflection mechanism. - * @param packageName Name of package - * @param set Resource set to use. Its project will be used to find the package. - * @return The package. <code>null</code> if name is not of correct format, or resource set is not associated with a project. - * - * @since 1.0.0 - */ - public JavaPackage reflectPackage(String packageName, ResourceSet set); - - /** - * The scheme for a java URI. - * - * @since 1.2.0 - */ - public static final String JAVA_PROTOCOL_URI_SCHEME = "java"; //$NON-NLS-1$ - - /** - * Create the URI for accessing a type through {@link ResourceSet#getEObject(URI, boolean)}. - * @param aQualifiedName - * @return - * - * @since 1.2.0 - */ - public URI createTypeURI(String aQualifiedName); - - /** - * Create the URI for accessing a type through {@link ResourceSet#getEObject(URI, boolean)}. - * @param packageName package name (may be <code>null</code> or <code>""</code> for primitives or default package) - * @param typeName type name - * @return - * - * @since 1.2.0 - */ - public URI createTypeURI(String packageName, String typeName); - - /** - * Create the URI for accessing a package through {@link ResourceSet#getEObject(URI, boolean)}. - * @param packageName package name (may be <code>null</code> or <code>""</code> for primitives or default package) - * @return - * - * @since 1.2.0 - */ - public URI createPackageURI(String packageName); - - /** - * Get just the type name without the package name. - * @param typeURI - * @return the type name or <code>""</code> if not a valid type URI - * - * @throws IllegalArgumentException if not a valid type URI - * @since 1.2.0 - */ - public String getTypeName(URI typeURI); - - /** - * Get just the package name. - * @param javaURI either a type or a package URI. - * @return package name or <code>""</code> if default package or primitive. - * - * @throws IllegalArgumentException if not a valid package or type URI - * @since 1.2.0 - */ - public String getPackageName(URI javaURI); - - /** - * Get the fully qualified type name. - * @param typeURI - * @return fully qualified name or <code>""</code> if not a valid type URI - * - * @throws IllegalArgumentException if not a valid type URI - * @since 1.2.0 - */ - public String getFullTypeName(URI typeURI); - - /** - * Is this a valid java uri. - * @param uri - * @return - * - * @since 1.2.0 - */ - public boolean isJavaURI(URI uri); - - /** - * Is this a valid type uri. - * @param uri - * @return - * - * @since 1.2.0 - */ - public boolean isTypeURI(URI uri); - - /** - * Is this a valid package uri. - * @param uri - * @return - * - * @since 1.2.0 - */ - public boolean isPackageURI(URI uri); - - /** - * @return ArrayType value with an array of the component type - */ - public ArrayType createArrayType(JavaHelpers componentType); - /** - * @return ArrayType value with an array of the specified dimensions and final component type. - */ - public ArrayType createArrayType(JavaHelpers finalComponentType, int dimensions); - /** - * @generated This field/method will be replaced during code generation - * @return Method value - */ - Method createMethod(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaClass value - */ - JavaClass createJavaClass(); - - /** - * @generated This field/method will be replaced during code generation - * @return Field value - */ - Field createField(); - - /** - * @generated This field/method will be replaced during code generation - * @return Block value - */ - Block createBlock(); - - /** - * @generated This field/method will be replaced during code generation - * @return Comment value - */ - Comment createComment(); - - /** - * @generated This field/method will be replaced during code generation - * @return Statement value - */ - Statement createStatement(); - - /** - * @generated This field/method will be replaced during code generation - * @return Initializer value - */ - Initializer createInitializer(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaParameter value - */ - JavaParameter createJavaParameter(); - - /** - * @generated This field/method will be replaced during code generation - * @return ArrayType value - */ - ArrayType createArrayType(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaDataType value - */ - JavaDataType createJavaDataType(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaPackage value - */ - JavaPackage createJavaPackage(); - - /** - * @generated This field/method will be replaced during code generation. - */ - JavaRefPackage getJavaRefPackage(); - -} - - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefPackage.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefPackage.java deleted file mode 100644 index 106ba96a5..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaRefPackage.java +++ /dev/null @@ -1,1972 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaRefPackage.java,v $ - * $Revision: 1.6 $ $Date: 2005/09/14 23:30:35 $ - */ -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; - - -/** - * @lastgen interface JavaRefPackage extends EPackage {} - */ -public interface JavaRefPackage extends EPackage{ - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "java"; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS = 0; - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EANNOTATIONS = EcorePackage.ECLASS__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__NAME = EcorePackage.ECLASS__NAME; - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__INSTANCE_CLASS_NAME = EcorePackage.ECLASS__INSTANCE_CLASS_NAME; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__INSTANCE_CLASS = EcorePackage.ECLASS__INSTANCE_CLASS; - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__DEFAULT_VALUE = EcorePackage.ECLASS__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EPACKAGE = EcorePackage.ECLASS__EPACKAGE; - - /** - * The feature id for the '<em><b>Abstract</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__ABSTRACT = EcorePackage.ECLASS__ABSTRACT; - - /** - * The feature id for the '<em><b>Interface</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__INTERFACE = EcorePackage.ECLASS__INTERFACE; - - /** - * The feature id for the '<em><b>ESuper Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__ESUPER_TYPES = EcorePackage.ECLASS__ESUPER_TYPES; - - /** - * The feature id for the '<em><b>EOperations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EOPERATIONS = EcorePackage.ECLASS__EOPERATIONS; - - /** - * The feature id for the '<em><b>EAll Attributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_ATTRIBUTES = EcorePackage.ECLASS__EALL_ATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll References</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_REFERENCES = EcorePackage.ECLASS__EALL_REFERENCES; - - /** - * The feature id for the '<em><b>EReferences</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EREFERENCES = EcorePackage.ECLASS__EREFERENCES; - - /** - * The feature id for the '<em><b>EAttributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EATTRIBUTES = EcorePackage.ECLASS__EATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll Containments</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_CONTAINMENTS = EcorePackage.ECLASS__EALL_CONTAINMENTS; - - /** - * The feature id for the '<em><b>EAll Operations</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_OPERATIONS = EcorePackage.ECLASS__EALL_OPERATIONS; - - /** - * The feature id for the '<em><b>EAll Structural Features</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_STRUCTURAL_FEATURES = EcorePackage.ECLASS__EALL_STRUCTURAL_FEATURES; - - /** - * The feature id for the '<em><b>EAll Super Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EALL_SUPER_TYPES = EcorePackage.ECLASS__EALL_SUPER_TYPES; - - /** - * The feature id for the '<em><b>EID Attribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__EID_ATTRIBUTE = EcorePackage.ECLASS__EID_ATTRIBUTE; - - /** - * The feature id for the '<em><b>EStructural Features</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__ESTRUCTURAL_FEATURES = EcorePackage.ECLASS__ESTRUCTURAL_FEATURES; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__KIND = EcorePackage.ECLASS_FEATURE_COUNT + 0; - /** - * The feature id for the '<em><b>Public</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__PUBLIC = EcorePackage.ECLASS_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Final</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS__FINAL = EcorePackage.ECLASS_FEATURE_COUNT + 2; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__IMPLEMENTS_INTERFACES = EcorePackage.ECLASS_FEATURE_COUNT + 3; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__CLASS_IMPORT = EcorePackage.ECLASS_FEATURE_COUNT + 4; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__PACKAGE_IMPORTS = EcorePackage.ECLASS_FEATURE_COUNT + 5; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__FIELDS = EcorePackage.ECLASS_FEATURE_COUNT + 6; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__METHODS = EcorePackage.ECLASS_FEATURE_COUNT + 7; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__INITIALIZERS = EcorePackage.ECLASS_FEATURE_COUNT + 8; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__DECLARED_CLASSES = EcorePackage.ECLASS_FEATURE_COUNT + 9; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__DECLARING_CLASS = EcorePackage.ECLASS_FEATURE_COUNT + 10; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__JAVA_PACKAGE = EcorePackage.ECLASS_FEATURE_COUNT + 11; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__EVENTS = EcorePackage.ECLASS_FEATURE_COUNT + 12; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_CLASS__ALL_EVENTS = EcorePackage.ECLASS_FEATURE_COUNT + 13; - /** - * The number of structural features of the the '<em>Java Class</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_CLASS_FEATURE_COUNT = EcorePackage.ECLASS_FEATURE_COUNT + 14; - - /** - * @generated This field/method will be replaced during code generation. - */ - int FIELD = 4; - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD = 3; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PARAMETER = 2; - /** - * @generated This field/method will be replaced during code generation. - */ - - - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE = 10; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_DATA_TYPE = 9; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_EVENT = 11; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PACKAGE = 8; - /** - * @generated This field/method will be replaced during code generation. - */ - int BLOCK = 5; - /** - * @generated This field/method will be replaced during code generation. - */ - int COMMENT = 6; - /** - * @generated This field/method will be replaced during code generation. - */ - int STATEMENT = 7; - /** - * @generated This field/method will be replaced during code generation. - */ - int INITIALIZER = 1; - /** - * @generated This field/method will be replaced during code generation. - */ - int INITIALIZER__IS_STATIC = 0; - /** - * @generated This field/method will be replaced during code generation. - */ - int INITIALIZER__JAVA_CLASS = 1; - /** - * @generated This field/method will be replaced during code generation. - */ - int INITIALIZER__SOURCE = 2; - - /** - * The number of structural features of the the '<em>Initializer</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INITIALIZER_FEATURE_COUNT = 3; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__EANNOTATIONS = EcorePackage.EPARAMETER__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PARAMETER__NAME = EcorePackage.EPARAMETER__NAME; - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__ORDERED = EcorePackage.EPARAMETER__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__UNIQUE = EcorePackage.EPARAMETER__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__LOWER_BOUND = EcorePackage.EPARAMETER__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__UPPER_BOUND = EcorePackage.EPARAMETER__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__MANY = EcorePackage.EPARAMETER__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__REQUIRED = EcorePackage.EPARAMETER__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__ETYPE = EcorePackage.EPARAMETER__ETYPE; - - /** - * The feature id for the '<em><b>EOperation</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__EOPERATION = EcorePackage.EPARAMETER__EOPERATION; - - /** - * The feature id for the '<em><b>Final</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER__FINAL = EcorePackage.EPARAMETER_FEATURE_COUNT + 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PARAMETER__PARAMETER_KIND = EcorePackage.EPARAMETER_FEATURE_COUNT + 1; - /** - * The number of structural features of the the '<em>Java Parameter</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PARAMETER_FEATURE_COUNT = EcorePackage.EPARAMETER_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__EANNOTATIONS = EcorePackage.EOPERATION__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__NAME = EcorePackage.EOPERATION__NAME; - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__ORDERED = EcorePackage.EOPERATION__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__UNIQUE = EcorePackage.EOPERATION__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__LOWER_BOUND = EcorePackage.EOPERATION__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__UPPER_BOUND = EcorePackage.EOPERATION__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__MANY = EcorePackage.EOPERATION__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__REQUIRED = EcorePackage.EOPERATION__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__ETYPE = EcorePackage.EOPERATION__ETYPE; - - /** - * The feature id for the '<em><b>EContaining Class</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__ECONTAINING_CLASS = EcorePackage.EOPERATION__ECONTAINING_CLASS; - - /** - * The feature id for the '<em><b>EParameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__EPARAMETERS = EcorePackage.EOPERATION__EPARAMETERS; - - /** - * The feature id for the '<em><b>EExceptions</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__EEXCEPTIONS = EcorePackage.EOPERATION__EEXCEPTIONS; - - /** - * The feature id for the '<em><b>Abstract</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__ABSTRACT = EcorePackage.EOPERATION_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Native</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__NATIVE = EcorePackage.EOPERATION_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Synchronized</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__SYNCHRONIZED = EcorePackage.EOPERATION_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Final</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__FINAL = EcorePackage.EOPERATION_FEATURE_COUNT + 3; - - /** - * The feature id for the '<em><b>Constructor</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__CONSTRUCTOR = EcorePackage.EOPERATION_FEATURE_COUNT + 4; - - /** - * The feature id for the '<em><b>Static</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD__STATIC = EcorePackage.EOPERATION_FEATURE_COUNT + 5; - - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__JAVA_VISIBILITY = EcorePackage.EOPERATION_FEATURE_COUNT + 6; - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__PARAMETERS = EcorePackage.EOPERATION_FEATURE_COUNT + 7; - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__JAVA_EXCEPTIONS = EcorePackage.EOPERATION_FEATURE_COUNT + 8; - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__JAVA_CLASS = EcorePackage.EOPERATION_FEATURE_COUNT + 9; - /** - * @generated This field/method will be replaced during code generation. - */ - int METHOD__SOURCE = EcorePackage.EOPERATION_FEATURE_COUNT + 10; - /** - * The number of structural features of the the '<em>Method</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int METHOD_FEATURE_COUNT = EcorePackage.EOPERATION_FEATURE_COUNT + 11; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__EANNOTATIONS = EcorePackage.ETYPED_ELEMENT__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int FIELD__NAME = EcorePackage.ETYPED_ELEMENT__NAME; - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__ORDERED = EcorePackage.ETYPED_ELEMENT__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__UNIQUE = EcorePackage.ETYPED_ELEMENT__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__LOWER_BOUND = EcorePackage.ETYPED_ELEMENT__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__UPPER_BOUND = EcorePackage.ETYPED_ELEMENT__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__MANY = EcorePackage.ETYPED_ELEMENT__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__REQUIRED = EcorePackage.ETYPED_ELEMENT__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__ETYPE = EcorePackage.ETYPED_ELEMENT__ETYPE; - - /** - * The feature id for the '<em><b>Final</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__FINAL = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Static</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__STATIC = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 1; - - /** - * @generated This field/method will be replaced during code generation. - */ - int FIELD__JAVA_VISIBILITY = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 2; - /** - * The feature id for the '<em><b>Transient</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__TRANSIENT = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 3; - - /** - * The feature id for the '<em><b>Volatile</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD__VOLATILE = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 4; - - /** - * @generated This field/method will be replaced during code generation. - */ - int FIELD__JAVA_CLASS = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 5; - /** - * @generated This field/method will be replaced during code generation. - */ - int FIELD__INITIALIZER = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 6; - /** - * The number of structural features of the the '<em>Field</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FIELD_FEATURE_COUNT = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 7; - - /** - * @generated This field/method will be replaced during code generation. - */ - int BLOCK__SOURCE = 0; - /** - * @generated This field/method will be replaced during code generation. - */ - int BLOCK__NAME = 1; - /** - * @generated This field/method will be replaced during code generation. - */ - int BLOCK__CONTENTS = 2; - - /** - * The number of structural features of the the '<em>Block</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int BLOCK_FEATURE_COUNT = 3; - - /** - * @generated This field/method will be replaced during code generation. - */ - int COMMENT__SOURCE = BLOCK__SOURCE; - /** - * @generated This field/method will be replaced during code generation. - */ - int COMMENT__NAME = BLOCK__NAME; - /** - * @generated This field/method will be replaced during code generation. - */ - int COMMENT__CONTENTS = BLOCK__CONTENTS; - - /** - * The number of structural features of the the '<em>Comment</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int COMMENT_FEATURE_COUNT = BLOCK_FEATURE_COUNT + 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - int STATEMENT__SOURCE = BLOCK__SOURCE; - /** - * @generated This field/method will be replaced during code generation. - */ - int STATEMENT__NAME = BLOCK__NAME; - /** - * @generated This field/method will be replaced during code generation. - */ - int STATEMENT__CONTENTS = BLOCK__CONTENTS; - - /** - * The number of structural features of the the '<em>Statement</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STATEMENT_FEATURE_COUNT = BLOCK_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__EANNOTATIONS = EcorePackage.EPACKAGE__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PACKAGE__NAME = EcorePackage.EPACKAGE__NAME; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PACKAGE__NS_URI = EcorePackage.EPACKAGE__NS_URI; - /** - * The feature id for the '<em><b>Ns Prefix</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__NS_PREFIX = EcorePackage.EPACKAGE__NS_PREFIX; - - /** - * The feature id for the '<em><b>EFactory Instance</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__EFACTORY_INSTANCE = EcorePackage.EPACKAGE__EFACTORY_INSTANCE; - - /** - * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__ECLASSIFIERS = EcorePackage.EPACKAGE__ECLASSIFIERS; - - /** - * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__ESUBPACKAGES = EcorePackage.EPACKAGE__ESUBPACKAGES; - - /** - * The feature id for the '<em><b>ESuper Package</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE__ESUPER_PACKAGE = EcorePackage.EPACKAGE__ESUPER_PACKAGE; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PACKAGE__JAVA_CLASSES = EcorePackage.EPACKAGE_FEATURE_COUNT + 0; - /** - * The number of structural features of the the '<em>Java Package</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_PACKAGE_FEATURE_COUNT = EcorePackage.EPACKAGE_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EANNOTATIONS = EcorePackage.ECLASS__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_DATA_TYPE__NAME = EcorePackage.ECLASS__NAME; - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__INSTANCE_CLASS_NAME = EcorePackage.ECLASS__INSTANCE_CLASS_NAME; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_DATA_TYPE__INSTANCE_CLASS = EcorePackage.ECLASS__INSTANCE_CLASS; - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__DEFAULT_VALUE = EcorePackage.ECLASS__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EPACKAGE = EcorePackage.ECLASS__EPACKAGE; - - /** - * The feature id for the '<em><b>Abstract</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__ABSTRACT = EcorePackage.ECLASS__ABSTRACT; - - /** - * The feature id for the '<em><b>Interface</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__INTERFACE = EcorePackage.ECLASS__INTERFACE; - - /** - * The feature id for the '<em><b>ESuper Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__ESUPER_TYPES = EcorePackage.ECLASS__ESUPER_TYPES; - - /** - * The feature id for the '<em><b>EOperations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EOPERATIONS = EcorePackage.ECLASS__EOPERATIONS; - - /** - * The feature id for the '<em><b>EAll Attributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_ATTRIBUTES = EcorePackage.ECLASS__EALL_ATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll References</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_REFERENCES = EcorePackage.ECLASS__EALL_REFERENCES; - - /** - * The feature id for the '<em><b>EReferences</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EREFERENCES = EcorePackage.ECLASS__EREFERENCES; - - /** - * The feature id for the '<em><b>EAttributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EATTRIBUTES = EcorePackage.ECLASS__EATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll Containments</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_CONTAINMENTS = EcorePackage.ECLASS__EALL_CONTAINMENTS; - - /** - * The feature id for the '<em><b>EAll Operations</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_OPERATIONS = EcorePackage.ECLASS__EALL_OPERATIONS; - - /** - * The feature id for the '<em><b>EAll Structural Features</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_STRUCTURAL_FEATURES = EcorePackage.ECLASS__EALL_STRUCTURAL_FEATURES; - - /** - * The feature id for the '<em><b>EAll Super Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EALL_SUPER_TYPES = EcorePackage.ECLASS__EALL_SUPER_TYPES; - - /** - * The feature id for the '<em><b>EID Attribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__EID_ATTRIBUTE = EcorePackage.ECLASS__EID_ATTRIBUTE; - - /** - * The feature id for the '<em><b>EStructural Features</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES = EcorePackage.ECLASS__ESTRUCTURAL_FEATURES; - - /** - * The number of structural features of the the '<em>Java Data Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_DATA_TYPE_FEATURE_COUNT = EcorePackage.ECLASS_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EANNOTATIONS = JAVA_CLASS__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__NAME = JAVA_CLASS__NAME; - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__INSTANCE_CLASS_NAME = JAVA_CLASS__INSTANCE_CLASS_NAME; - - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__INSTANCE_CLASS = JAVA_CLASS__INSTANCE_CLASS; - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__DEFAULT_VALUE = JAVA_CLASS__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EPACKAGE = JAVA_CLASS__EPACKAGE; - - /** - * The feature id for the '<em><b>Abstract</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__ABSTRACT = JAVA_CLASS__ABSTRACT; - - /** - * The feature id for the '<em><b>Interface</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__INTERFACE = JAVA_CLASS__INTERFACE; - - /** - * The feature id for the '<em><b>ESuper Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__ESUPER_TYPES = JAVA_CLASS__ESUPER_TYPES; - - /** - * The feature id for the '<em><b>EOperations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EOPERATIONS = JAVA_CLASS__EOPERATIONS; - - /** - * The feature id for the '<em><b>EAll Attributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_ATTRIBUTES = JAVA_CLASS__EALL_ATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll References</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_REFERENCES = JAVA_CLASS__EALL_REFERENCES; - - /** - * The feature id for the '<em><b>EReferences</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EREFERENCES = JAVA_CLASS__EREFERENCES; - - /** - * The feature id for the '<em><b>EAttributes</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EATTRIBUTES = JAVA_CLASS__EATTRIBUTES; - - /** - * The feature id for the '<em><b>EAll Containments</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_CONTAINMENTS = JAVA_CLASS__EALL_CONTAINMENTS; - - /** - * The feature id for the '<em><b>EAll Operations</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_OPERATIONS = JAVA_CLASS__EALL_OPERATIONS; - - /** - * The feature id for the '<em><b>EAll Structural Features</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_STRUCTURAL_FEATURES = JAVA_CLASS__EALL_STRUCTURAL_FEATURES; - - /** - * The feature id for the '<em><b>EAll Super Types</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EALL_SUPER_TYPES = JAVA_CLASS__EALL_SUPER_TYPES; - - /** - * The feature id for the '<em><b>EID Attribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__EID_ATTRIBUTE = JAVA_CLASS__EID_ATTRIBUTE; - - /** - * The feature id for the '<em><b>EStructural Features</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__ESTRUCTURAL_FEATURES = JAVA_CLASS__ESTRUCTURAL_FEATURES; - - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__KIND = JAVA_CLASS__KIND; - /** - * The feature id for the '<em><b>Public</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__PUBLIC = JAVA_CLASS__PUBLIC; - - /** - * The feature id for the '<em><b>Final</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE__FINAL = JAVA_CLASS__FINAL; - - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__IMPLEMENTS_INTERFACES = JAVA_CLASS__IMPLEMENTS_INTERFACES; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__CLASS_IMPORT = JAVA_CLASS__CLASS_IMPORT; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__PACKAGE_IMPORTS = JAVA_CLASS__PACKAGE_IMPORTS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__FIELDS = JAVA_CLASS__FIELDS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__METHODS = JAVA_CLASS__METHODS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__INITIALIZERS = JAVA_CLASS__INITIALIZERS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__DECLARED_CLASSES = JAVA_CLASS__DECLARED_CLASSES; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__DECLARING_CLASS = JAVA_CLASS__DECLARING_CLASS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__JAVA_PACKAGE = JAVA_CLASS__JAVA_PACKAGE; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__EVENTS = JAVA_CLASS__EVENTS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__ALL_EVENTS = JAVA_CLASS__ALL_EVENTS; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__ARRAY_DIMENSIONS = JAVA_CLASS_FEATURE_COUNT + 0; - /** - * @generated This field/method will be replaced during code generation. - */ - int ARRAY_TYPE__COMPONENT_TYPE = JAVA_CLASS_FEATURE_COUNT + 1; - /** - * The number of structural features of the the '<em>Array Type</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARRAY_TYPE_FEATURE_COUNT = JAVA_CLASS_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__EANNOTATIONS = EcorePackage.ESTRUCTURAL_FEATURE__EANNOTATIONS; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_EVENT__NAME = EcorePackage.ESTRUCTURAL_FEATURE__NAME; - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__ORDERED = EcorePackage.ESTRUCTURAL_FEATURE__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__UNIQUE = EcorePackage.ESTRUCTURAL_FEATURE__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__LOWER_BOUND = EcorePackage.ESTRUCTURAL_FEATURE__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__UPPER_BOUND = EcorePackage.ESTRUCTURAL_FEATURE__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__MANY = EcorePackage.ESTRUCTURAL_FEATURE__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__REQUIRED = EcorePackage.ESTRUCTURAL_FEATURE__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__ETYPE = EcorePackage.ESTRUCTURAL_FEATURE__ETYPE; - - /** - * The feature id for the '<em><b>Changeable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__CHANGEABLE = EcorePackage.ESTRUCTURAL_FEATURE__CHANGEABLE; - - /** - * The feature id for the '<em><b>Volatile</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__VOLATILE = EcorePackage.ESTRUCTURAL_FEATURE__VOLATILE; - - /** - * The feature id for the '<em><b>Transient</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__TRANSIENT = EcorePackage.ESTRUCTURAL_FEATURE__TRANSIENT; - - /** - * The feature id for the '<em><b>Default Value Literal</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__DEFAULT_VALUE_LITERAL = EcorePackage.ESTRUCTURAL_FEATURE__DEFAULT_VALUE_LITERAL; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__DEFAULT_VALUE = EcorePackage.ESTRUCTURAL_FEATURE__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Unsettable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__UNSETTABLE = EcorePackage.ESTRUCTURAL_FEATURE__UNSETTABLE; - - /** - * The feature id for the '<em><b>Derived</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__DERIVED = EcorePackage.ESTRUCTURAL_FEATURE__DERIVED; - - /** - * The feature id for the '<em><b>EContaining Class</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT__ECONTAINING_CLASS = EcorePackage.ESTRUCTURAL_FEATURE__ECONTAINING_CLASS; - - /** - * The number of structural features of the the '<em>Java Event</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_EVENT_FEATURE_COUNT = EcorePackage.ESTRUCTURAL_FEATURE_FEATURE_COUNT + 0; - - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_VISIBILITY_KIND = 13; - /** - * @generated This field/method will be replaced during code generation. - */ - int JAVA_PARAMETER_KIND = 14; - /** - * The meta object id for the '<em>JType Java Helpers</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jem.java.JavaHelpers - * @see org.eclipse.jem.java.internal.impl.JavaRefPackageImpl#getJTypeJavaHelpers() - * @generated - */ - int JTYPE_JAVA_HELPERS = 15; - - /** - * The meta object id for the '<em>JType List</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see java.util.List - * @see org.eclipse.jem.java.internal.impl.JavaRefPackageImpl#getJTypeList() - * @generated - */ - int JTYPE_LIST = 16; - - - /** - * @generated This field/method will be replaced during code generation. - */ - int TYPE_KIND = 12; - /** - * @generated This field/method will be replaced during code generation. - */ - String eNS_URI = "java.xmi"; - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "org.eclipse.jem.java"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JavaRefPackage eINSTANCE = org.eclipse.jem.java.internal.impl.JavaRefPackageImpl.init(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaClass object - */ - EClass getJavaClass(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getJavaClass_Kind(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.JavaClass#isPublic <em>Public</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Public</em>'. - * @see org.eclipse.jem.java.JavaClass#isPublic() - * @see #getJavaClass() - * @generated - */ - EAttribute getJavaClass_Public(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.JavaClass#isFinal <em>Final</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Final</em>'. - * @see org.eclipse.jem.java.JavaClass#isFinal() - * @see #getJavaClass() - * @generated - */ - EAttribute getJavaClass_Final(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_ImplementsInterfaces(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_ClassImport(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_PackageImports(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_Fields(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_Methods(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_Initializers(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_DeclaringClass(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_DeclaredClasses(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_JavaPackage(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_Events(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaClass_AllEvents(); - - /** - * @generated This field/method will be replaced during code generation - * @return Field object - */ - EClass getField(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Field#isFinal <em>Final</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Final</em>'. - * @see org.eclipse.jem.java.Field#isFinal() - * @see #getField() - * @generated - */ - EAttribute getField_Final(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Field#isStatic <em>Static</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Static</em>'. - * @see org.eclipse.jem.java.Field#isStatic() - * @see #getField() - * @generated - */ - EAttribute getField_Static(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getField_JavaVisibility(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Field#isTransient <em>Transient</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Transient</em>'. - * @see org.eclipse.jem.java.Field#isTransient() - * @see #getField() - * @generated - */ - EAttribute getField_Transient(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Field#isVolatile <em>Volatile</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Volatile</em>'. - * @see org.eclipse.jem.java.Field#isVolatile() - * @see #getField() - * @generated - */ - EAttribute getField_Volatile(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getField_JavaClass(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getField_Initializer(); - - /** - * @generated This field/method will be replaced during code generation - * @return Method object - */ - EClass getMethod(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isAbstract <em>Abstract</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Abstract</em>'. - * @see org.eclipse.jem.java.Method#isAbstract() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Abstract(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isNative <em>Native</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Native</em>'. - * @see org.eclipse.jem.java.Method#isNative() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Native(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isSynchronized <em>Synchronized</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Synchronized</em>'. - * @see org.eclipse.jem.java.Method#isSynchronized() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Synchronized(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isFinal <em>Final</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Final</em>'. - * @see org.eclipse.jem.java.Method#isFinal() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Final(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isConstructor <em>Constructor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Constructor</em>'. - * @see org.eclipse.jem.java.Method#isConstructor() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Constructor(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.Method#isStatic <em>Static</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Static</em>'. - * @see org.eclipse.jem.java.Method#isStatic() - * @see #getMethod() - * @generated - */ - EAttribute getMethod_Static(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getMethod_JavaVisibility(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getMethod_Parameters(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getMethod_JavaExceptions(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getMethod_JavaClass(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getMethod_Source(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaParameter object - */ - EClass getJavaParameter(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jem.java.JavaParameter#isFinal <em>Final</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Final</em>'. - * @see org.eclipse.jem.java.JavaParameter#isFinal() - * @see #getJavaParameter() - * @generated - */ - EAttribute getJavaParameter_Final(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getJavaParameter_ParameterKind(); - - /** - * @generated This field/method will be replaced during code generation - * @return ArrayType object - */ - EClass getArrayType(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getArrayType_ArrayDimensions(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getArrayType_ComponentType(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaDataType object - */ - EClass getJavaDataType(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaEvent object - */ - EClass getJavaEvent(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaPackage object - */ - EClass getJavaPackage(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getJavaPackage_JavaClasses(); - - /** - * @generated This field/method will be replaced during code generation - * @return Block object - */ - EClass getBlock(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getBlock_Source(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getBlock_Name(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getBlock_Contents(); - - /** - * @generated This field/method will be replaced during code generation - * @return Comment object - */ - EClass getComment(); - - /** - * @generated This field/method will be replaced during code generation - * @return Statement object - */ - EClass getStatement(); - - /** - * @generated This field/method will be replaced during code generation - * @return Initializer object - */ - EClass getInitializer(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EAttribute getInitializer_IsStatic(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getInitializer_JavaClass(); - - /** - * @generated This field/method will be replaced during code generation. - */ - EReference getInitializer_Source(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaVisibilityKind object - */ - EEnum getJavaVisibilityKind(); - - /** - * @generated This field/method will be replaced during code generation - * @return JavaParameterKind object - */ - EEnum getJavaParameterKind(); - - /** - * @generated This field/method will be replaced during code generation - * @return TypeKind object - */ - EEnum getTypeKind(); - - /** - * @generated This field/method will be replaced during code generation - * @return JTypeList object - */ - EDataType getJTypeList(); - - /** - * @generated This field/method will be replaced during code generation - * @return JTypeJavaHelpers object - */ - EDataType getJTypeJavaHelpers(); - - /** - * @generated This field/method will be replaced during code generation. - */ - JavaRefFactory getJavaRefFactory(); - -} //JavaRefPackage - - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaURL.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaURL.java deleted file mode 100644 index 9f6792873..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaURL.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaURL.java,v $ - * $Revision: 1.8 $ $Date: 2006/05/17 20:13:08 $ - */ - - -/** - * @deprecated Use the appropriate {@link JavaRefFactory} URI methods instead. - * - * @since 1.2.0 - */ -public class JavaURL extends org.eclipse.jem.java.internal.impl.URL { - public static final String JAVA_PROTOCOL_URI_PREFIX = "java:/"; //$NON-NLS-1$ - /** - * JavaURL constructor comment. - * @param urlString java.lang.String - * - * @deprecated Use {@link JavaRefFactory#createTypeURI(String)} or {@link JavaRefFactory#createPackageURI(String)} - */ - public JavaURL(String urlString) { - super(urlString); - } - /** - * JavaURL constructor comment. - * @param nameSpaceName java.lang.String - * @param iD java.lang.String - * @deprecated Use {@link JavaRefFactory#createTypeURI(String, String)} - * - */ - public JavaURL(String nameSpaceName, String iD) { - super(null, null); - initializeNamespaceString(nameSpaceName); - this.ID = iD; - } - - /** - * - * @return - * @deprecated Use {@link JavaRefFactory#getTypeName(org.eclipse.emf.common.util.URI)} - */ - public String getClassName() { - return ID; - } - - /** - * This method was created in VisualAge. - * @return java.lang.String - * - * @deprecated Use {@link JavaRefFactory#getFullTypeName(org.eclipse.emf.common.util.URI)} - */ - public String getFullString() { - StringBuffer buf = new StringBuffer(); - if (namespaceName != null) { - buf.append(namespaceName); - if (ID != null) - buf.append("#"); //$NON-NLS-1$ - } - if (ID != null) - buf.append(ID); - return buf.toString(); - } - - /** - * - * @return - * @deprecated Use {@link JavaRefFactory#getPackageName(org.eclipse.emf.common.util.URI)} - * @since 1.2.0 - */ - public String getPackageName() { - String internalName = namespaceName.substring(JAVA_PROTOCOL_URI_PREFIX.length(), namespaceName.length()); - return JavaPackage.PRIMITIVE_PACKAGE_NAME.equals(internalName) ? "" : internalName; //$NON-NLS-1$ - } - /* If we don't have a # sign to delimit the start of the java package us the inherited behavior - */ - public void initializeFromString(String url) { - if (url.indexOf("#") != -1) //$NON-NLS-1$ - super.initializeFromString(url); - else { - int endOfPackageName = url.lastIndexOf('.'); - if (endOfPackageName == -1) - initializeNamespaceString(null); - else - initializeNamespaceString(url.substring(0, endOfPackageName)); - ID = url.substring(endOfPackageName + 1); - } - - } - /* - */ - public void initializeNamespaceString(String aNamespaceName) { - if (aNamespaceName == null) - namespaceName = JAVA_PROTOCOL_URI_PREFIX; - else - namespaceName = JAVA_PROTOCOL_URI_PREFIX + aNamespaceName; - } - - /** - * - * @param aUrlString - * @return - * @deprecated Use {@link JavaRefFactory#isJavaURI(org.eclipse.emf.common.util.URI)} - */ - public static boolean isJavaURL(String aUrlString) { - if (aUrlString == null) - return false; - return aUrlString.startsWith(JAVA_PROTOCOL_URI_PREFIX); - } - - public String toString() { - return "URL(" + getFullString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaVisibilityKind.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaVisibilityKind.java deleted file mode 100644 index 4ce813da6..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/JavaVisibilityKind.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: JavaVisibilityKind.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.AbstractEnumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Java Visibility Kind</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * PACKAGE=1 - * PUBLIC=2 - * PRIVATE=3 - * PROTECTED=4 - * <!-- end-model-doc --> - * @see org.eclipse.jem.java.JavaRefPackage#getJavaVisibilityKind() - * @model - * @generated - */ -public final class JavaVisibilityKind extends AbstractEnumerator -{ - /** - * The '<em><b>PUBLIC</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #PUBLIC_LITERAL - * @model - * @generated - * @ordered - */ - public static final int PUBLIC = 0; - - /** - * The '<em><b>PRIVATE</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #PRIVATE_LITERAL - * @model - * @generated - * @ordered - */ - public static final int PRIVATE = 1; - - /** - * The '<em><b>PROTECTED</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #PROTECTED_LITERAL - * @model - * @generated - * @ordered - */ - public static final int PROTECTED = 2; - - /** - * The '<em><b>PACKAGE</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #PACKAGE_LITERAL - * @model - * @generated - * @ordered - */ - public static final int PACKAGE = 3; - - /** - * The '<em><b>PUBLIC</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>PUBLIC</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #PUBLIC - * @generated - * @ordered - */ - public static final JavaVisibilityKind PUBLIC_LITERAL = new JavaVisibilityKind(PUBLIC, "PUBLIC"); - - /** - * The '<em><b>PRIVATE</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>PRIVATE</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #PRIVATE - * @generated - * @ordered - */ - public static final JavaVisibilityKind PRIVATE_LITERAL = new JavaVisibilityKind(PRIVATE, "PRIVATE"); - - /** - * The '<em><b>PROTECTED</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>PROTECTED</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #PROTECTED - * @generated - * @ordered - */ - public static final JavaVisibilityKind PROTECTED_LITERAL = new JavaVisibilityKind(PROTECTED, "PROTECTED"); - - /** - * The '<em><b>PACKAGE</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>PACKAGE</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #PACKAGE - * @generated - * @ordered - */ - public static final JavaVisibilityKind PACKAGE_LITERAL = new JavaVisibilityKind(PACKAGE, "PACKAGE"); - - /** - * An array of all the '<em><b>Java Visibility Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final JavaVisibilityKind[] VALUES_ARRAY = - new JavaVisibilityKind[] { - PUBLIC_LITERAL, - PRIVATE_LITERAL, - PROTECTED_LITERAL, - PACKAGE_LITERAL, - }; - - /** - * A public read-only list of all the '<em><b>Java Visibility Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Java Visibility Kind</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static JavaVisibilityKind get(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - JavaVisibilityKind result = VALUES_ARRAY[i]; - if (result.toString().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Java Visibility Kind</b></em>' literal with the specified value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static JavaVisibilityKind get(int value) { - switch (value) { - case PUBLIC: return PUBLIC_LITERAL; - case PRIVATE: return PRIVATE_LITERAL; - case PROTECTED: return PROTECTED_LITERAL; - case PACKAGE: return PACKAGE_LITERAL; - } - return null; - } - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private JavaVisibilityKind(int value, String name) { - super(value, name); - } - -} //JavaVisibilityKind diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Method.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Method.java deleted file mode 100644 index 3e5369e93..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Method.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; - -/* - * $RCSfile: Method.java,v $ - * $Revision: 1.7 $ $Date: 2005/09/15 13:42:04 $ - */ -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EOperation; - -/** - * @generated - */ -public interface Method extends EOperation{ - - public static final String GENERATED_COMMENT_TAG = "@generated"; - /** - * Lists all the parameters, excluding the return type - */ - public JavaParameter[] listParametersWithoutReturn(); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsAbstract attribute - */ - boolean isAbstract(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isAbstract <em>Abstract</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Abstract</em>' attribute. - * @see #isAbstract() - * @generated - */ - void setAbstract(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsNative attribute - */ - boolean isNative(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isNative <em>Native</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Native</em>' attribute. - * @see #isNative() - * @generated - */ - void setNative(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsSynchronized attribute - */ - boolean isSynchronized(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isSynchronized <em>Synchronized</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Synchronized</em>' attribute. - * @see #isSynchronized() - * @generated - */ - void setSynchronized(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsFinal attribute - */ - boolean isFinal(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isFinal <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Final</em>' attribute. - * @see #isFinal() - * @generated - */ - void setFinal(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsConstructor attribute - */ - boolean isConstructor(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isConstructor <em>Constructor</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Constructor</em>' attribute. - * @see #isConstructor() - * @generated - */ - void setConstructor(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the IsStatic attribute - */ - boolean isStatic(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#isStatic <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Static</em>' attribute. - * @see #isStatic() - * @generated - */ - void setStatic(boolean value); - - /** - * @generated This field/method will be replaced during code generation - * @return The value of the JavaVisibility attribute - */ - JavaVisibilityKind getJavaVisibility(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#getJavaVisibility <em>Java Visibility</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Visibility</em>' attribute. - * @see org.eclipse.jem.java.JavaVisibilityKind - * @see #getJavaVisibility() - * @generated - */ - void setJavaVisibility(JavaVisibilityKind value); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of Parameters references - */ - EList getParameters(); - - /** - * @generated This field/method will be replaced during code generation - * @return The list of JavaExceptions references - */ - EList getJavaExceptions(); - - /** - * @generated This field/method will be replaced during code generation - * @return The JavaClass reference - */ - JavaClass getJavaClass(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#getJavaClass <em>Java Class</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Java Class</em>' container reference. - * @see #getJavaClass() - * @generated - */ - void setJavaClass(JavaClass value); - - /** - * @generated This field/method will be replaced during code generation - * @return The Source reference - */ - Block getSource(); - - /** - * Sets the value of the '{@link org.eclipse.jem.java.Method#getSource <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source</em>' reference. - * @see #getSource() - * @generated - */ - void setSource(Block value); - - /** - * @generated This field/method will be replaced during code generation - * Return the java class that this method is defined in. - */ - JavaClass getContainingJavaClass(); - - /** - * @generated This field/method will be replaced during code generation - * Return a String with the the method name and its parameters. e.g. <code> - * setFirstName(java.lang.String) <//code> . - * - */ - String getMethodElementSignature(); - - /** - * @generated This field/method will be replaced during code generation - * Return a Parameter with the passed name, or null. - */ - JavaParameter getParameter(String parameterName); - - /** - * @generated This field/method will be replaced during code generation - * Get the return type. - */ - JavaHelpers getReturnType(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * Set the return type - * <!-- end-model-doc --> - * @model typeDataType="org.eclipse.jem.java.JTypeJavaHelpers" - * @generated - */ - void setReturnType(JavaHelpers type); - - /** - * @generated This field/method will be replaced during code generation - * Replicate the functionality of java.lang.reflect.Method.toString(). - * - * Returns a string describing this Method. The string is formatted as the method - * access modifiers, if any, followed by the method return type, followed by a - * space, followed by the class declaring the method, followed by a period, - * followed by the method name, followed by a parenthesized, comma-separated list - * of the method's formal parameter types. If the method throws checked - * exceptions, the parameter list is followed by a space, followed by the word - * throws followed by a comma-separated list of the thrown exception types. - * - * For example: - * - * public boolean java.lang.Object.equals(java.lang.Object) - * - * The access modifiers are placed in canonical order as specified by "The Java - * Language Specification". This is public, <tt>protected<//tt> or - * <tt>private<//tt> first, and then other modifiers in the following order: - * <tt>abstract<//tt>, <tt>static<//tt>, <tt>final<//tt>, <tt>synchronized<//tt> - * <tt>native<//tt>. - - */ - String getSignature(); - - /** - * @generated This field/method will be replaced during code generation - * Returns true if the method is system generated. - * This is usually determined by the @generated tag in the comment. - */ - boolean isGenerated(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * Set the isGenerated flag. - * <!-- end-model-doc --> - * @model - * @generated - */ - void setIsGenerated(boolean generated); - - /** - * @generated This field/method will be replaced during code generation - * Is this a void return type method. - */ - boolean isVoid(); - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Statement.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Statement.java deleted file mode 100644 index 1aa557ead..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/Statement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: Statement.java,v $ - * $Revision: 1.5 $ $Date: 2005/08/24 20:20:24 $ - */ -package org.eclipse.jem.java; - -/** - * @generated - */ -public interface Statement extends Block { - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/TypeKind.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/TypeKind.java deleted file mode 100644 index e2a5769a0..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/TypeKind.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java; -/* - * $RCSfile: TypeKind.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.AbstractEnumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Type Kind</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * UNDEFINED=1 CLASS=2 INTERFACE=3 EXCEPTION=4 - * <!-- end-model-doc --> - * @see org.eclipse.jem.java.JavaRefPackage#getTypeKind() - * @model - * @generated - */ -public final class TypeKind extends AbstractEnumerator -{ - /** - * The '<em><b>UNDEFINED</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #UNDEFINED_LITERAL - * @model - * @generated - * @ordered - */ - public static final int UNDEFINED = 0; - - /** - * The '<em><b>CLASS</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #CLASS_LITERAL - * @model - * @generated - * @ordered - */ - public static final int CLASS = 1; - - /** - * The '<em><b>INTERFACE</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #INTERFACE_LITERAL - * @model - * @generated - * @ordered - */ - public static final int INTERFACE = 2; - - /** - * The '<em><b>EXCEPTION</b></em>' literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #EXCEPTION_LITERAL - * @model - * @generated - * @ordered - */ - public static final int EXCEPTION = 3; - - /** - * The '<em><b>UNDEFINED</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>UNDEFINED</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #UNDEFINED - * @generated - * @ordered - */ - public static final TypeKind UNDEFINED_LITERAL = new TypeKind(UNDEFINED, "UNDEFINED"); - - /** - * The '<em><b>CLASS</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>CLASS</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #CLASS - * @generated - * @ordered - */ - public static final TypeKind CLASS_LITERAL = new TypeKind(CLASS, "CLASS"); - - /** - * The '<em><b>INTERFACE</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>INTERFACE</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #INTERFACE - * @generated - * @ordered - */ - public static final TypeKind INTERFACE_LITERAL = new TypeKind(INTERFACE, "INTERFACE"); - - /** - * The '<em><b>EXCEPTION</b></em>' literal object. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>EXCEPTION</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #EXCEPTION - * @generated - * @ordered - */ - public static final TypeKind EXCEPTION_LITERAL = new TypeKind(EXCEPTION, "EXCEPTION"); - - /** - * An array of all the '<em><b>Type Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final TypeKind[] VALUES_ARRAY = - new TypeKind[] { - UNDEFINED_LITERAL, - CLASS_LITERAL, - INTERFACE_LITERAL, - EXCEPTION_LITERAL, - }; - - /** - * A public read-only list of all the '<em><b>Type Kind</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Type Kind</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static TypeKind get(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - TypeKind result = VALUES_ARRAY[i]; - if (result.toString().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Type Kind</b></em>' literal with the specified value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static TypeKind get(int value) { - switch (value) { - case UNDEFINED: return UNDEFINED_LITERAL; - case CLASS: return CLASS_LITERAL; - case INTERFACE: return INTERFACE_LITERAL; - case EXCEPTION: return EXCEPTION_LITERAL; - } - return null; - } - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private TypeKind(int value, String name) { - super(value, name); - } - -} //TypeKind diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKey.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKey.java deleted file mode 100644 index 4605d58cb..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKey.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IJavaReflectionKey.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -package org.eclipse.jem.java.adapters; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jem.java.*; - -public interface IJavaReflectionKey { - - /* Constants for the primitive type names - * These are the values which are used to refer to a primitive type, - * i.e. new JavaURL("int") or new URL("java://#int") - * These types are cached by pre-loading documents for the primitives, - * in "java://", and for the java.lang (Object and String) classes - */ - static final public String N_VOID = "void"; //$NON-NLS-1$ - static final public String N_INT = "int";//$NON-NLS-1$ - static final public String N_BOOLEAN = "boolean";//$NON-NLS-1$ - static final public String N_CHAR = "char";//$NON-NLS-1$ - static final public String N_BYTE = "byte";//$NON-NLS-1$ - static final public String N_LONG = "long";//$NON-NLS-1$ - static final public String N_FLOAT = "float";//$NON-NLS-1$ - static final public String N_DOUBLE = "double";//$NON-NLS-1$ - static final public String N_SHORT = "short";//$NON-NLS-1$ - - /* - * Create an ArrayType instance in the current document - * Handles the push and pop of the current document. - */ - public abstract ArrayType createArrayType(); - - /* - * Create a JavaClass instance in the current document - * Handles the push and pop of the current document. - */ - public abstract JavaClass createJavaClass(); - - /* - * Create a Field instance in the current document - * Handles the push and pop of the current document. - */ - public abstract Field createJavaField(); - - /* - * Create a Method instance in the current document - * Handles the push and pop of the current document. - */ - public abstract Method createJavaMethod(); - - /* - * Create a JavaParameter instance in the current document - */ - public abstract JavaParameter createJavaParameter(); - - //FB/** - //FB * Override to try to introspect objects - //FB * that aren't found using the default mechanism. - //FB */ - //FBpublic Object get(Object key) { - //FB Object javaObject = super.get(key); - //FB if (javaObject == null) { - //FB javaObject = getObjectFromExtensions((String) key); - //FB if (javaObject == null) - //FB javaObject = getJavaObject((String) key); - //FB } - //FB return javaObject; - //FB} - - //FB ADDED - public abstract Object get(String key); - - //FB END - - /* - * Instantiate the named class. - * If we make it to this point, the class has not yet been instantiated or reflected. - */ - public abstract EClassifier getArrayType(String typeName); - - /* - * Instantiate the named class. - * If we make it to this point, teh class has not yet been instantiated or reflected. - */ - public abstract EClassifier getJavaClass(String typeName); - - /** - * This allows for the retrieval of attributes/methods with the following notation: - * field: java:/com.ibm.foo#Test.foo - * method: java:/com.ibm.foo#Test.foofoo( - * parameter: java:/com.ibm.foo#Test.foofoo(-arg0 - * - */ - public abstract EObject getJavaObject(String keyValue); - - /** - * Insert the method's description here. - * Creation date: (10/4/2000 9:52:28 AM) - * @return org.eclipse.emf.ecore.EClassifier - * @param typeName java.lang.String - */ - public abstract EClassifier getJavaType(String typeName); - - /** - * Get the object from the key but don't do any - * tries at creation of the key if not found. - * The Key must be an ID for it to be found. - */ - public abstract Object primGet(String key); - - /** - * Return true if the passed type represents a Java Array type - */ - public abstract boolean isArray(String typeName); - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKeyExtension.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKeyExtension.java deleted file mode 100644 index ba6d35bc8..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/IJavaReflectionKeyExtension.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IJavaReflectionKeyExtension.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -package org.eclipse.jem.java.adapters; - -/** - * Extension interface to add an additional reflection key in to handle - * other types of key's not specifically handled. - * - * @since 1.0.0 - */ -public interface IJavaReflectionKeyExtension { - - /** - * Get the object from the given id. - * @param id - * @param reflectionKey - * @return the object (it should add the id with object to the resource's id table before returning it) or <code>null</code> if not one it handles. - * - * @since 1.0.0 - */ - public Object getObject(String id, IJavaReflectionKey reflectionKey); - -} - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/JavaXMIFactory.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/JavaXMIFactory.java deleted file mode 100644 index 78df6fd5d..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/adapters/JavaXMIFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaXMIFactory.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -package org.eclipse.jem.java.adapters; - -import org.eclipse.jem.internal.java.adapters.JavaXMIFactoryImpl; - - -/** - * Factory for Java XMI Resources. - * @since 1.2.0 - */ -public interface JavaXMIFactory { - - /** - * Scheme used in URI's for jem elements. - * @since 1.2.0 - */ - public static final String SCHEME = "java"; //$NON-NLS-1$ - public static final JavaXMIFactory INSTANCE = new JavaXMIFactoryImpl(); - - /** - * Register the reflection key extension. - * @param extension - * - * @since 1.2.0 - */ - public void registerReflectionKeyExtension(IJavaReflectionKeyExtension extension); - - /** - * Deregister the reflection key extension. - * @param extension - * - * @since 1.2.0 - */ - public void deregisterReflectionKeyExtension(IJavaReflectionKeyExtension extension); -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaRefPackageImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaRefPackageImpl.java deleted file mode 100644 index df4c6d37f..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/impl/JavaRefPackageImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaRefPackageImpl.java,v $ - * $Revision: 1.10 $ $Date: 2006/01/17 15:57:42 $ - */ -package org.eclipse.jem.java.impl; - -import org.eclipse.jem.java.JavaRefPackage; - - - -/** - * - * Do not use. This is here only for the older pre-EMF 2.2 generated code that accesses the package directly instead of through the interface. - * This is kind of API and must not go away, but new clients should not reference this class. - * @since 1.2.0 - */ -public class JavaRefPackageImpl extends org.eclipse.jem.java.internal.impl.JavaRefPackageImpl { - - public JavaRefPackageImpl() { - super(true); - } - - /** - * Do not use. This is here only for the older pre-EMF 2.2 generated code that accesses the package directly instead of through the interface. - * @return - * @deprecated Do not use. This is here only for the older pre-EMF 2.2 generated code that accesses the package directly instead of through the interface. - * @since 1.2.0 - */ - public static JavaRefPackage init() { - return org.eclipse.jem.java.internal.impl.JavaRefPackageImpl.init(); - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/ArrayTypeImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/ArrayTypeImpl.java deleted file mode 100644 index 8de14f650..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/ArrayTypeImpl.java +++ /dev/null @@ -1,688 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: ArrayTypeImpl.java,v $ - * $Revision: 1.2 $ $Date: 2005/09/15 20:28:04 $ - */ - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.*; -import org.eclipse.jem.java.ArrayType; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.java.TypeKind; - -/** - * Describes a Java Array type - * For multi-dimensional arrays, it is unlikely that the component type will be - * specified directly. This would require instantiating a chain of component types - * such as String[][][][]->String[][][]->String[][]->String[]->String. - * - * The component type relationship will be computed if the finalComponentType - * and array dimensions is specified. - * - * For this reason, the preferred way to create is through the JavaRefFactory factory method: - * createArrayType(JavaClass finalComponentType, int dimensions) - */ -public class ArrayTypeImpl extends JavaClassImpl implements ArrayType, JavaClass{ - - /** - * The default value of the '{@link #getArrayDimensions() <em>Array Dimensions</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getArrayDimensions() - * @generated - * @ordered - */ - protected static final int ARRAY_DIMENSIONS_EDEFAULT = 0; - - - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected int arrayDimensions = ARRAY_DIMENSIONS_EDEFAULT; - /** - * The cached value of the '{@link #getComponentType() <em>Component Type</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getComponentType() - * @generated - * @ordered - */ - protected EClassifier componentType = null; - - protected JavaHelpers finalComponentType = null; - - protected ArrayTypeImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getArrayType(); - } - - /** - * Compute the component type for this array type from our type name. - * The component type of this array type is essentially: new ArrayTypeImpl(finalComponentType, arrayDimensions-1) - * unless our array dimension is 1, in which case it is only our final component type. - * - * In order to ensure a unique instance, we will resolve this type using reflection. - * "java.lang.String[][]" component type is "java.lang.String[]" - * - */ - public JavaHelpers computeComponentType() { - String componentName = getQualifiedNameForReflection(); - // Strip the last [] form my name to get my component type's name - componentName = componentName.substring(0, componentName.length() - 2); - return JavaRefFactory.eINSTANCE.reflectType(componentName, this); - } - /** - * Override to perform some lazy initialization - */ - public EClassifier getComponentType() { - // If we do not have a component type set, but we have a name (which contains our component type name) - // we can compute the component type. - if ((this.getComponentTypeGen() == null) && (this.getName() != null)) { - componentType = computeComponentType(); - } - return getComponentTypeGen(); - } - /** - * Get the component type of this array. - * - * If this is a multi-dimensional array, the component type will be the nested array type. - */ - public JavaHelpers getComponentTypeAsHelper() { - return (JavaHelpers) getComponentType(); - } - /** - * Get the final component type for this Array Type. - * - * In order to ensure a unique instance, we will resolve this type using reflection. It turns out to be most efficient to just do this by trimming the name. - */ - public JavaHelpers getFinalComponentType() { - if (finalComponentType == null) { - String componentName = getQualifiedNameForReflection(); - // Strip all the [] from my name to get my FINAL component type's name - componentName = componentName.substring(0, componentName.indexOf("[")); - finalComponentType = JavaRefFactory.eINSTANCE.reflectType(componentName, this); - } - return finalComponentType; - } - /** - * (JavaHelpers)isArray - ArrayTypes are arrays - * Override from JavaClass. - */ - public boolean isArray() { - return true; - } - /** - * Is this an array of java primitives - */ - public boolean isPrimitiveArray() { - return getFinalComponentType().isPrimitive(); - } - /** - * Set the component type. - */ - public void setComponentType(JavaHelpers helperComponentType) { - setComponentType((EClassifier) helperComponentType); - } - /** - * @generated This field/method will be replaced during code generation - */ - public int getArrayDimensions() { - return arrayDimensions; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setArrayDimensions(int newArrayDimensions) { - int oldArrayDimensions = arrayDimensions; - arrayDimensions = newArrayDimensions; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.ARRAY_TYPE__ARRAY_DIMENSIONS, oldArrayDimensions, arrayDimensions)); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS_NAME: - return INSTANCE_CLASS_NAME_EDEFAULT == null ? instanceClassName != null : !INSTANCE_CLASS_NAME_EDEFAULT.equals(instanceClassName); - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS: - return INSTANCE_CLASS_EDEFAULT == null ? getInstanceClass() != null : !INSTANCE_CLASS_EDEFAULT.equals(getInstanceClass()); - case JavaRefPackage.ARRAY_TYPE__DEFAULT_VALUE: - return DEFAULT_VALUE_EDEFAULT == null ? getDefaultValue() != null : !DEFAULT_VALUE_EDEFAULT.equals(getDefaultValue()); - case JavaRefPackage.ARRAY_TYPE__EPACKAGE: - return getEPackage() != null; - case JavaRefPackage.ARRAY_TYPE__ABSTRACT: - return ((eFlags & ABSTRACT_EFLAG) != 0) != ABSTRACT_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__INTERFACE: - return ((eFlags & INTERFACE_EFLAG) != 0) != INTERFACE_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__ESUPER_TYPES: - return eSuperTypes != null && !eSuperTypes.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - return eOperations != null && !eOperations.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_ATTRIBUTES: - return !getEAllAttributes().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_REFERENCES: - return !getEAllReferences().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EREFERENCES: - return !getEReferences().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EATTRIBUTES: - return !getEAttributes().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_CONTAINMENTS: - return !getEAllContainments().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_OPERATIONS: - return !getEAllOperations().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_STRUCTURAL_FEATURES: - return !getEAllStructuralFeatures().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EALL_SUPER_TYPES: - return !getEAllSuperTypes().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__EID_ATTRIBUTE: - return getEIDAttribute() != null; - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - return eStructuralFeatures != null && !eStructuralFeatures.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__KIND: - return kind != KIND_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__PUBLIC: - return ((eFlags & PUBLIC_EFLAG) != 0) != PUBLIC_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__FINAL: - return ((eFlags & FINAL_EFLAG) != 0) != FINAL_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__IMPLEMENTS_INTERFACES: - return implementsInterfaces != null && !implementsInterfaces.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__CLASS_IMPORT: - return classImport != null && !classImport.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__PACKAGE_IMPORTS: - return packageImports != null && !packageImports.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__FIELDS: - return fields != null && !fields.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__METHODS: - return methods != null && !methods.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - return initializers != null && !initializers.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - return declaredClasses != null && !declaredClasses.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - return declaringClass != null; - case JavaRefPackage.ARRAY_TYPE__JAVA_PACKAGE: - return basicGetJavaPackage() != null; - case JavaRefPackage.ARRAY_TYPE__EVENTS: - return events != null && !events.isEmpty(); - case JavaRefPackage.ARRAY_TYPE__ALL_EVENTS: - return !getAllEvents().isEmpty(); - case JavaRefPackage.ARRAY_TYPE__ARRAY_DIMENSIONS: - return arrayDimensions != ARRAY_DIMENSIONS_EDEFAULT; - case JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE: - return componentType != null; - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__NAME: - setName((String)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS_NAME: - setInstanceClassName((String)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__ABSTRACT: - setAbstract(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.ARRAY_TYPE__INTERFACE: - setInterface(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.ARRAY_TYPE__ESUPER_TYPES: - getESuperTypes().clear(); - getESuperTypes().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - getEOperations().clear(); - getEOperations().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - getEStructuralFeatures().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__KIND: - setKind((TypeKind)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__PUBLIC: - setPublic(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.ARRAY_TYPE__FINAL: - setFinal(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.ARRAY_TYPE__IMPLEMENTS_INTERFACES: - getImplementsInterfaces().clear(); - getImplementsInterfaces().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__CLASS_IMPORT: - getClassImport().clear(); - getClassImport().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__PACKAGE_IMPORTS: - getPackageImports().clear(); - getPackageImports().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__FIELDS: - getFields().clear(); - getFields().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__METHODS: - getMethods().clear(); - getMethods().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - getInitializers().clear(); - getInitializers().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - getDeclaredClasses().clear(); - getDeclaredClasses().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - setDeclaringClass((JavaClass)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__EVENTS: - getEvents().clear(); - getEvents().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__ALL_EVENTS: - getAllEvents().clear(); - getAllEvents().addAll((Collection)newValue); - return; - case JavaRefPackage.ARRAY_TYPE__ARRAY_DIMENSIONS: - setArrayDimensions(((Integer)newValue).intValue()); - return; - case JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE: - setComponentType((EClassifier)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS_NAME: - setInstanceClassName(INSTANCE_CLASS_NAME_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__ABSTRACT: - setAbstract(ABSTRACT_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__INTERFACE: - setInterface(INTERFACE_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__ESUPER_TYPES: - getESuperTypes().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - getEOperations().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__KIND: - setKind(KIND_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__PUBLIC: - setPublic(PUBLIC_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__FINAL: - setFinal(FINAL_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__IMPLEMENTS_INTERFACES: - getImplementsInterfaces().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__CLASS_IMPORT: - getClassImport().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__PACKAGE_IMPORTS: - getPackageImports().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__FIELDS: - getFields().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__METHODS: - getMethods().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - getInitializers().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - getDeclaredClasses().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - setDeclaringClass((JavaClass)null); - return; - case JavaRefPackage.ARRAY_TYPE__EVENTS: - getEvents().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__ALL_EVENTS: - getAllEvents().clear(); - return; - case JavaRefPackage.ARRAY_TYPE__ARRAY_DIMENSIONS: - setArrayDimensions(ARRAY_DIMENSIONS_EDEFAULT); - return; - case JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE: - setComponentType((EClassifier)null); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (arrayDimensions: "); - result.append(arrayDimensions); - result.append(')'); - return result.toString(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public EClassifier getComponentTypeGen() { - if (componentType != null && componentType.eIsProxy()) { - EClassifier oldComponentType = componentType; - componentType = (EClassifier)eResolveProxy((InternalEObject)componentType); - if (componentType != oldComponentType) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE, oldComponentType, componentType)); - } - } - return componentType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClassifier basicGetComponentType() { - return componentType; - } - - public void setComponentType(EClassifier newComponentType) { - finalComponentType = null; - setComponentTypeGen(newComponentType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setComponentTypeGen(EClassifier newComponentType) { - EClassifier oldComponentType = componentType; - componentType = newComponentType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE, oldComponentType, componentType)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__EPACKAGE: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.ARRAY_TYPE__EPACKAGE, msgs); - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - return ((InternalEList)getEOperations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__FIELDS: - return ((InternalEList)getFields()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__METHODS: - return ((InternalEList)getMethods()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - return ((InternalEList)getInitializers()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - return ((InternalEList)getDeclaredClasses()).basicAdd(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - if (declaringClass != null) - msgs = ((InternalEObject)declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs); - return basicSetDeclaringClass((JavaClass)otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__EPACKAGE: - return eBasicSetContainer(null, JavaRefPackage.ARRAY_TYPE__EPACKAGE, msgs); - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - return ((InternalEList)getEOperations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__FIELDS: - return ((InternalEList)getFields()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__METHODS: - return ((InternalEList)getMethods()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - return ((InternalEList)getInitializers()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - return ((InternalEList)getDeclaredClasses()).basicRemove(otherEnd, msgs); - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - return basicSetDeclaringClass(null, msgs); - case JavaRefPackage.ARRAY_TYPE__EVENTS: - return ((InternalEList)getEvents()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.ARRAY_TYPE__EPACKAGE: - return eContainer.eInverseRemove(this, EcorePackage.EPACKAGE__ECLASSIFIERS, EPackage.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.ARRAY_TYPE__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.ARRAY_TYPE__NAME: - return getName(); - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS_NAME: - return getInstanceClassName(); - case JavaRefPackage.ARRAY_TYPE__INSTANCE_CLASS: - return getInstanceClass(); - case JavaRefPackage.ARRAY_TYPE__DEFAULT_VALUE: - return getDefaultValue(); - case JavaRefPackage.ARRAY_TYPE__EPACKAGE: - return getEPackage(); - case JavaRefPackage.ARRAY_TYPE__ABSTRACT: - return isAbstract() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.ARRAY_TYPE__INTERFACE: - return isInterface() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.ARRAY_TYPE__ESUPER_TYPES: - return getESuperTypes(); - case JavaRefPackage.ARRAY_TYPE__EOPERATIONS: - return getEOperations(); - case JavaRefPackage.ARRAY_TYPE__EALL_ATTRIBUTES: - return getEAllAttributes(); - case JavaRefPackage.ARRAY_TYPE__EALL_REFERENCES: - return getEAllReferences(); - case JavaRefPackage.ARRAY_TYPE__EREFERENCES: - return getEReferences(); - case JavaRefPackage.ARRAY_TYPE__EATTRIBUTES: - return getEAttributes(); - case JavaRefPackage.ARRAY_TYPE__EALL_CONTAINMENTS: - return getEAllContainments(); - case JavaRefPackage.ARRAY_TYPE__EALL_OPERATIONS: - return getEAllOperations(); - case JavaRefPackage.ARRAY_TYPE__EALL_STRUCTURAL_FEATURES: - return getEAllStructuralFeatures(); - case JavaRefPackage.ARRAY_TYPE__EALL_SUPER_TYPES: - return getEAllSuperTypes(); - case JavaRefPackage.ARRAY_TYPE__EID_ATTRIBUTE: - return getEIDAttribute(); - case JavaRefPackage.ARRAY_TYPE__ESTRUCTURAL_FEATURES: - return getEStructuralFeatures(); - case JavaRefPackage.ARRAY_TYPE__KIND: - return getKind(); - case JavaRefPackage.ARRAY_TYPE__PUBLIC: - return isPublic() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.ARRAY_TYPE__FINAL: - return isFinal() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.ARRAY_TYPE__IMPLEMENTS_INTERFACES: - return getImplementsInterfaces(); - case JavaRefPackage.ARRAY_TYPE__CLASS_IMPORT: - return getClassImport(); - case JavaRefPackage.ARRAY_TYPE__PACKAGE_IMPORTS: - return getPackageImports(); - case JavaRefPackage.ARRAY_TYPE__FIELDS: - return getFields(); - case JavaRefPackage.ARRAY_TYPE__METHODS: - return getMethods(); - case JavaRefPackage.ARRAY_TYPE__INITIALIZERS: - return getInitializers(); - case JavaRefPackage.ARRAY_TYPE__DECLARED_CLASSES: - return getDeclaredClasses(); - case JavaRefPackage.ARRAY_TYPE__DECLARING_CLASS: - if (resolve) return getDeclaringClass(); - return basicGetDeclaringClass(); - case JavaRefPackage.ARRAY_TYPE__JAVA_PACKAGE: - if (resolve) return getJavaPackage(); - return basicGetJavaPackage(); - case JavaRefPackage.ARRAY_TYPE__EVENTS: - return getEvents(); - case JavaRefPackage.ARRAY_TYPE__ALL_EVENTS: - return getAllEvents(); - case JavaRefPackage.ARRAY_TYPE__ARRAY_DIMENSIONS: - return new Integer(getArrayDimensions()); - case JavaRefPackage.ARRAY_TYPE__COMPONENT_TYPE: - if (resolve) return getComponentType(); - return basicGetComponentType(); - } - return eDynamicGet(eFeature, resolve); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaClass#getKind() - */ - public TypeKind getKind() { - // Override to always return the class if final type is valid. - JavaHelpers ft = getFinalComponentType(); - if (!ft.isPrimitive()) { - TypeKind ftKind = ((JavaClass) ft).getKind(); - return ftKind != TypeKind.UNDEFINED_LITERAL ? TypeKind.CLASS_LITERAL : TypeKind.UNDEFINED_LITERAL; - } else - return TypeKind.CLASS_LITERAL; - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaClass#isPublic() - */ - public boolean isPublic() { - // Override to return the kind of the final component, because that determines it. - JavaHelpers ft = getFinalComponentType(); - if (!ft.isPrimitive()) { - return ((JavaClass) ft).isPublic(); - } else - return true; - } -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/BlockImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/BlockImpl.java deleted file mode 100644 index 6eff12ee5..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/BlockImpl.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; - -/* - * $RCSfile: BlockImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.Block; -import org.eclipse.jem.java.JavaRefPackage; - -/** - * @generated - */ -public class BlockImpl extends EObjectImpl implements Block{ - - /** - * The default value of the '{@link #getSource() <em>Source</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSource() - * @generated - * @ordered - */ - protected static final String SOURCE_EDEFAULT = null; - - - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected String source = SOURCE_EDEFAULT; - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected String name = NAME_EDEFAULT; - /** - * The cached value of the '{@link #getContents() <em>Contents</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getContents() - * @generated - * @ordered - */ - protected EList contents = null; - - protected BlockImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getBlock(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getSource() { - return source; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setSource(String newSource) { - String oldSource = source; - source = newSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.BLOCK__SOURCE, oldSource, source)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public String getName() { - return name; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.BLOCK__NAME, oldName, name)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public EList getContents() { - if (contents == null) { - contents = new EObjectContainmentEList(Block.class, this, JavaRefPackage.BLOCK__CONTENTS); - } - return contents; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.BLOCK__CONTENTS: - return ((InternalEList)getContents()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.BLOCK__SOURCE: - return getSource(); - case JavaRefPackage.BLOCK__NAME: - return getName(); - case JavaRefPackage.BLOCK__CONTENTS: - return getContents(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.BLOCK__SOURCE: - return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT.equals(source); - case JavaRefPackage.BLOCK__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.BLOCK__CONTENTS: - return contents != null && !contents.isEmpty(); - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.BLOCK__SOURCE: - setSource((String)newValue); - return; - case JavaRefPackage.BLOCK__NAME: - setName((String)newValue); - return; - case JavaRefPackage.BLOCK__CONTENTS: - getContents().clear(); - getContents().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.BLOCK__SOURCE: - setSource(SOURCE_EDEFAULT); - return; - case JavaRefPackage.BLOCK__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.BLOCK__CONTENTS: - getContents().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (source: "); - result.append(source); - result.append(", name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/CommentImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/CommentImpl.java deleted file mode 100644 index cd18ea3b5..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/CommentImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; - -/* - * $RCSfile: CommentImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.Comment; -import org.eclipse.jem.java.JavaRefPackage; -/** - * @generated - */ -public class CommentImpl extends BlockImpl implements Comment{ - - - protected CommentImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getComment(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.COMMENT__CONTENTS: - return ((InternalEList)getContents()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.COMMENT__SOURCE: - return getSource(); - case JavaRefPackage.COMMENT__NAME: - return getName(); - case JavaRefPackage.COMMENT__CONTENTS: - return getContents(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.COMMENT__SOURCE: - setSource((String)newValue); - return; - case JavaRefPackage.COMMENT__NAME: - setName((String)newValue); - return; - case JavaRefPackage.COMMENT__CONTENTS: - getContents().clear(); - getContents().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.COMMENT__SOURCE: - setSource(SOURCE_EDEFAULT); - return; - case JavaRefPackage.COMMENT__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.COMMENT__CONTENTS: - getContents().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.COMMENT__SOURCE: - return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT.equals(source); - case JavaRefPackage.COMMENT__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.COMMENT__CONTENTS: - return contents != null && !contents.isEmpty(); - } - return eDynamicIsSet(eFeature); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/FieldImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/FieldImpl.java deleted file mode 100644 index b1ffc24c0..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/FieldImpl.java +++ /dev/null @@ -1,735 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: FieldImpl.java,v $ - * $Revision: 1.4 $ $Date: 2006/05/17 20:13:07 $ - */ -package org.eclipse.jem.java.internal.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.ETypedElementImpl; - -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.*; -import org.eclipse.jem.internal.java.adapters.ReadAdaptor; -import org.eclipse.jem.internal.java.adapters.ReflectionAdaptor; - -/** - * @generated - */ -public class FieldImpl extends ETypedElementImpl implements Field { - - /** - * The default value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final boolean FINAL_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final int FINAL_EFLAG = 1 << 10; - - /** - * The default value of the '{@link #isStatic() <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStatic() - * @generated - * @ordered - */ - protected static final boolean STATIC_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isStatic() <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStatic() - * @generated - * @ordered - */ - protected static final int STATIC_EFLAG = 1 << 11; - - /** - * The default value of the '{@link #getJavaVisibility() <em>Java Visibility</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJavaVisibility() - * @generated - * @ordered - */ - protected static final JavaVisibilityKind JAVA_VISIBILITY_EDEFAULT = JavaVisibilityKind.PUBLIC_LITERAL; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected JavaVisibilityKind javaVisibility = JAVA_VISIBILITY_EDEFAULT; - - /** - * The default value of the '{@link #isTransient() <em>Transient</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTransient() - * @generated - * @ordered - */ - protected static final boolean TRANSIENT_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isTransient() <em>Transient</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTransient() - * @generated - * @ordered - */ - protected static final int TRANSIENT_EFLAG = 1 << 12; - - /** - * The default value of the '{@link #isVolatile() <em>Volatile</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isVolatile() - * @generated - * @ordered - */ - protected static final boolean VOLATILE_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isVolatile() <em>Volatile</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isVolatile() - * @generated - * @ordered - */ - protected static final int VOLATILE_EFLAG = 1 << 13; - - /** - * The cached value of the '{@link #getInitializer() <em>Initializer</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInitializer() - * @generated - * @ordered - */ - protected Block initializer = null; - - protected FieldImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getField(); - } - - /** - * createFieldRef - return a JavaURL reference to the named field in the named Java class in the form "package.class_field" - * @deprecated no replacement at this time. - */ - public static Field createFieldRef(String className, String fieldName) { - Field ref = JavaRefFactory.eINSTANCE.createField(); - URI classURI = JavaRefFactory.eINSTANCE.createTypeURI(className); - ((InternalEObject) ref).eSetProxyURI(URI.createURI(classURI.toString()+ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER+fieldName)); - return ref; - } - - /** - * Get the class that this field is within. - */ - public JavaClass getContainingJavaClass() { - return this.getJavaClass(); - } - - /** - * Overrides to perform lazy initializations/reflection. - */ - public EClassifier getEType() { - reflectValues(); - return super.getEType(); - } - - public Block getInitializer() { - reflectValues(); - return getInitializerGen(); - } - - public boolean isFinal() { - reflectValues(); - return isFinalGen(); - } - - public boolean isStatic() { - reflectValues(); - return isStaticGen(); - } - - public boolean isTransient() { - reflectValues(); - return isTransientGen(); - } - - public boolean isVolatile() { - reflectValues(); - return isVolatileGen(); - } - - public JavaHelpers getJavaType() { - return (JavaHelpers) getEType(); - } - - public JavaVisibilityKind getJavaVisibility() { - reflectValues(); - return getJavaVisibilityGen(); - } - - protected synchronized ReadAdaptor getReadAdapter() { - return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY); - } - - protected boolean hasReflected = false; - - protected void reflectValues() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if (!hasReflected) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = readAdaptor.reflectValuesIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - hasReflected = setReflected; - } - } - } - - /* - * Used by reflection adapter to clear the reflection. This not intended to be used by others. - */ - public synchronized void setReflected(boolean reflected) { - hasReflected = reflected; - } - - /** - * Is this field an array type. - */ - public boolean isArray() { - return getJavaType().isArray(); - } - - /** - * Overridden to prevent the reflection of the class. - */ - public EList eContents() { - EList results = new BasicEList(); - //FB - //FB EList containments = eClass().getEAllContainments(); - //FB if (containments != null) { - //FB Iterator i = containments.iterator(); - //FB while (i.hasNext()) { - //FB EStructuralFeature sf = (EStructuralFeature) i.next(); - //FB //Change from super to primRefValue - //FB Object value = primRefValue(sf); - //FB //EndChange - //FB if (value != null) - //FB if (sf.isMany()) - //FB results.addAll((Collection) value); - //FB else - //FB results.add(value); - //FB } - //FB } - if (getInitializerGen() != null) - results.add(getInitializerGen()); //FB - return results; - } - - public String toString() { - return getClass().getName() + " " + "(" + getName() + ")"; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaVisibilityKind getJavaVisibilityGen() { - return javaVisibility; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isFinalGen() { - return (eFlags & FINAL_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFinal(boolean newFinal) { - boolean oldFinal = (eFlags & FINAL_EFLAG) != 0; - if (newFinal) eFlags |= FINAL_EFLAG; else eFlags &= ~FINAL_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__FINAL, oldFinal, newFinal)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isStaticGen() { - return (eFlags & STATIC_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatic(boolean newStatic) { - boolean oldStatic = (eFlags & STATIC_EFLAG) != 0; - if (newStatic) eFlags |= STATIC_EFLAG; else eFlags &= ~STATIC_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__STATIC, oldStatic, newStatic)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJavaVisibility(JavaVisibilityKind newJavaVisibility) { - JavaVisibilityKind oldJavaVisibility = javaVisibility; - javaVisibility = newJavaVisibility == null ? JAVA_VISIBILITY_EDEFAULT : newJavaVisibility; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__JAVA_VISIBILITY, oldJavaVisibility, javaVisibility)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isTransientGen() { - return (eFlags & TRANSIENT_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTransient(boolean newTransient) { - boolean oldTransient = (eFlags & TRANSIENT_EFLAG) != 0; - if (newTransient) eFlags |= TRANSIENT_EFLAG; else eFlags &= ~TRANSIENT_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__TRANSIENT, oldTransient, newTransient)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isVolatileGen() { - return (eFlags & VOLATILE_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setVolatile(boolean newVolatile) { - boolean oldVolatile = (eFlags & VOLATILE_EFLAG) != 0; - if (newVolatile) eFlags |= VOLATILE_EFLAG; else eFlags &= ~VOLATILE_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__VOLATILE, oldVolatile, newVolatile)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaClass getJavaClass() { - if (eContainerFeatureID != JavaRefPackage.FIELD__JAVA_CLASS) return null; - return (JavaClass)eContainer; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJavaClass(JavaClass newJavaClass) { - if (newJavaClass != eContainer || (eContainerFeatureID != JavaRefPackage.FIELD__JAVA_CLASS && newJavaClass != null)) { - if (EcoreUtil.isAncestor(this, newJavaClass)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newJavaClass != null) - msgs = ((InternalEObject)newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs); - msgs = eBasicSetContainer((InternalEObject)newJavaClass, JavaRefPackage.FIELD__JAVA_CLASS, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__JAVA_CLASS, newJavaClass, newJavaClass)); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.FIELD__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.FIELD__ORDERED: - return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT; - case JavaRefPackage.FIELD__UNIQUE: - return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT; - case JavaRefPackage.FIELD__LOWER_BOUND: - return lowerBound != LOWER_BOUND_EDEFAULT; - case JavaRefPackage.FIELD__UPPER_BOUND: - return upperBound != UPPER_BOUND_EDEFAULT; - case JavaRefPackage.FIELD__MANY: - return isMany() != MANY_EDEFAULT; - case JavaRefPackage.FIELD__REQUIRED: - return isRequired() != REQUIRED_EDEFAULT; - case JavaRefPackage.FIELD__ETYPE: - return eType != null; - case JavaRefPackage.FIELD__FINAL: - return ((eFlags & FINAL_EFLAG) != 0) != FINAL_EDEFAULT; - case JavaRefPackage.FIELD__STATIC: - return ((eFlags & STATIC_EFLAG) != 0) != STATIC_EDEFAULT; - case JavaRefPackage.FIELD__JAVA_VISIBILITY: - return javaVisibility != JAVA_VISIBILITY_EDEFAULT; - case JavaRefPackage.FIELD__TRANSIENT: - return ((eFlags & TRANSIENT_EFLAG) != 0) != TRANSIENT_EDEFAULT; - case JavaRefPackage.FIELD__VOLATILE: - return ((eFlags & VOLATILE_EFLAG) != 0) != VOLATILE_EDEFAULT; - case JavaRefPackage.FIELD__JAVA_CLASS: - return getJavaClass() != null; - case JavaRefPackage.FIELD__INITIALIZER: - return initializer != null; - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.FIELD__NAME: - setName((String)newValue); - return; - case JavaRefPackage.FIELD__ORDERED: - setOrdered(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__UNIQUE: - setUnique(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__LOWER_BOUND: - setLowerBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.FIELD__UPPER_BOUND: - setUpperBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.FIELD__ETYPE: - setEType((EClassifier)newValue); - return; - case JavaRefPackage.FIELD__FINAL: - setFinal(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__STATIC: - setStatic(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__JAVA_VISIBILITY: - setJavaVisibility((JavaVisibilityKind)newValue); - return; - case JavaRefPackage.FIELD__TRANSIENT: - setTransient(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__VOLATILE: - setVolatile(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.FIELD__JAVA_CLASS: - setJavaClass((JavaClass)newValue); - return; - case JavaRefPackage.FIELD__INITIALIZER: - setInitializer((Block)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.FIELD__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.FIELD__ORDERED: - setOrdered(ORDERED_EDEFAULT); - return; - case JavaRefPackage.FIELD__UNIQUE: - setUnique(UNIQUE_EDEFAULT); - return; - case JavaRefPackage.FIELD__LOWER_BOUND: - setLowerBound(LOWER_BOUND_EDEFAULT); - return; - case JavaRefPackage.FIELD__UPPER_BOUND: - setUpperBound(UPPER_BOUND_EDEFAULT); - return; - case JavaRefPackage.FIELD__ETYPE: - setEType((EClassifier)null); - return; - case JavaRefPackage.FIELD__FINAL: - setFinal(FINAL_EDEFAULT); - return; - case JavaRefPackage.FIELD__STATIC: - setStatic(STATIC_EDEFAULT); - return; - case JavaRefPackage.FIELD__JAVA_VISIBILITY: - setJavaVisibility(JAVA_VISIBILITY_EDEFAULT); - return; - case JavaRefPackage.FIELD__TRANSIENT: - setTransient(TRANSIENT_EDEFAULT); - return; - case JavaRefPackage.FIELD__VOLATILE: - setVolatile(VOLATILE_EDEFAULT); - return; - case JavaRefPackage.FIELD__JAVA_CLASS: - setJavaClass((JavaClass)null); - return; - case JavaRefPackage.FIELD__INITIALIZER: - setInitializer((Block)null); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public Block getInitializerGen() { - return initializer; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetInitializer(Block newInitializer, NotificationChain msgs) { - Block oldInitializer = initializer; - initializer = newInitializer; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__INITIALIZER, oldInitializer, newInitializer); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setInitializer(Block newInitializer) { - if (newInitializer != initializer) { - NotificationChain msgs = null; - if (initializer != null) - msgs = ((InternalEObject)initializer).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs); - if (newInitializer != null) - msgs = ((InternalEObject)newInitializer).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaRefPackage.FIELD__INITIALIZER, null, msgs); - msgs = basicSetInitializer(newInitializer, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.FIELD__INITIALIZER, newInitializer, newInitializer)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.FIELD__JAVA_CLASS: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.FIELD__JAVA_CLASS, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.FIELD__JAVA_CLASS: - return eBasicSetContainer(null, JavaRefPackage.FIELD__JAVA_CLASS, msgs); - case JavaRefPackage.FIELD__INITIALIZER: - return basicSetInitializer(null, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.FIELD__JAVA_CLASS: - return eContainer.eInverseRemove(this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaClass.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.FIELD__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.FIELD__NAME: - return getName(); - case JavaRefPackage.FIELD__ORDERED: - return isOrdered() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__UNIQUE: - return isUnique() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__LOWER_BOUND: - return new Integer(getLowerBound()); - case JavaRefPackage.FIELD__UPPER_BOUND: - return new Integer(getUpperBound()); - case JavaRefPackage.FIELD__MANY: - return isMany() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__REQUIRED: - return isRequired() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__ETYPE: - if (resolve) return getEType(); - return basicGetEType(); - case JavaRefPackage.FIELD__FINAL: - return isFinal() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__STATIC: - return isStatic() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__JAVA_VISIBILITY: - return getJavaVisibility(); - case JavaRefPackage.FIELD__TRANSIENT: - return isTransient() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__VOLATILE: - return isVolatile() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.FIELD__JAVA_CLASS: - return getJavaClass(); - case JavaRefPackage.FIELD__INITIALIZER: - return getInitializer(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toStringGen() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (final: "); - result.append((eFlags & FINAL_EFLAG) != 0); - result.append(", static: "); - result.append((eFlags & STATIC_EFLAG) != 0); - result.append(", javaVisibility: "); - result.append(javaVisibility); - result.append(", transient: "); - result.append((eFlags & TRANSIENT_EFLAG) != 0); - result.append(", volatile: "); - result.append((eFlags & VOLATILE_EFLAG) != 0); - result.append(')'); - return result.toString(); - } - -} - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/InitializerImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/InitializerImpl.java deleted file mode 100644 index a72550ba4..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/InitializerImpl.java +++ /dev/null @@ -1,297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: InitializerImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.jem.java.Block; -import org.eclipse.jem.java.Initializer; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefPackage; -/** - * @generated - */ -public class InitializerImpl extends EObjectImpl implements Initializer{ - - /** - * The default value of the '{@link #getIsStatic() <em>Is Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getIsStatic() - * @generated - * @ordered - */ - protected static final Boolean IS_STATIC_EDEFAULT = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected Boolean isStatic = IS_STATIC_EDEFAULT; - /** - * The cached value of the '{@link #getSource() <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSource() - * @generated - * @ordered - */ - protected Block source = null; - - protected InitializerImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getInitializer(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public Boolean getIsStatic() { - return isStatic; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void setIsStatic(Boolean newIsStatic) { - Boolean oldIsStatic = isStatic; - isStatic = newIsStatic; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.INITIALIZER__IS_STATIC, oldIsStatic, isStatic)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaClass getJavaClass() { - if (eContainerFeatureID != JavaRefPackage.INITIALIZER__JAVA_CLASS) return null; - return (JavaClass)eContainer; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJavaClass(JavaClass newJavaClass) { - if (newJavaClass != eContainer || (eContainerFeatureID != JavaRefPackage.INITIALIZER__JAVA_CLASS && newJavaClass != null)) { - if (EcoreUtil.isAncestor(this, newJavaClass)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newJavaClass != null) - msgs = ((InternalEObject)newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__INITIALIZERS, JavaClass.class, msgs); - msgs = eBasicSetContainer((InternalEObject)newJavaClass, JavaRefPackage.INITIALIZER__JAVA_CLASS, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.INITIALIZER__JAVA_CLASS, newJavaClass, newJavaClass)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public Block getSource() { - if (source != null && source.eIsProxy()) { - Block oldSource = source; - source = (Block)eResolveProxy((InternalEObject)source); - if (source != oldSource) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.INITIALIZER__SOURCE, oldSource, source)); - } - } - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Block basicGetSource() { - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSource(Block newSource) { - Block oldSource = source; - source = newSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.INITIALIZER__SOURCE, oldSource, source)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.INITIALIZER__JAVA_CLASS, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - return eBasicSetContainer(null, JavaRefPackage.INITIALIZER__JAVA_CLASS, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - return eContainer.eInverseRemove(this, JavaRefPackage.JAVA_CLASS__INITIALIZERS, JavaClass.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.INITIALIZER__IS_STATIC: - return getIsStatic(); - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - return getJavaClass(); - case JavaRefPackage.INITIALIZER__SOURCE: - if (resolve) return getSource(); - return basicGetSource(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.INITIALIZER__IS_STATIC: - return IS_STATIC_EDEFAULT == null ? isStatic != null : !IS_STATIC_EDEFAULT.equals(isStatic); - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - return getJavaClass() != null; - case JavaRefPackage.INITIALIZER__SOURCE: - return source != null; - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.INITIALIZER__IS_STATIC: - setIsStatic((Boolean)newValue); - return; - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - setJavaClass((JavaClass)newValue); - return; - case JavaRefPackage.INITIALIZER__SOURCE: - setSource((Block)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.INITIALIZER__IS_STATIC: - setIsStatic(IS_STATIC_EDEFAULT); - return; - case JavaRefPackage.INITIALIZER__JAVA_CLASS: - setJavaClass((JavaClass)null); - return; - case JavaRefPackage.INITIALIZER__SOURCE: - setSource((Block)null); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (isStatic: "); - result.append(isStatic); - result.append(')'); - return result.toString(); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java deleted file mode 100644 index e2040fda8..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java +++ /dev/null @@ -1,1949 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaClassImpl.java,v $ - * $Revision: 1.4 $ $Date: 2006/05/17 20:13:07 $ - */ -package org.eclipse.jem.java.internal.impl; - -import java.util.Collection; -import java.util.List; - -import java.util.*; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.EClassImpl; -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.*; - -import org.eclipse.emf.ecore.*; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.*; - -import org.eclipse.jem.internal.java.adapters.*; -import org.eclipse.jem.internal.java.beaninfo.IIntrospectionAdapter; -import org.eclipse.jem.internal.java.instantiation.IInstantiationInstance; - -/** - * <!-- begin-user-doc --> - * - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getKind <em>Kind</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#isPublic <em>Public</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#isFinal <em>Final</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getImplementsInterfaces <em>Implements Interfaces</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getClassImport <em>Class Import</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getPackageImports <em>Package Imports</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getFields <em>Fields</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getMethods <em>Methods</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getInitializers <em>Initializers</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getDeclaredClasses <em>Declared Classes</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getDeclaringClass <em>Declaring Class</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getJavaPackage <em>Java Package</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getEvents <em>Events</em>}</li> - * <li>{@link org.eclipse.jem.java.internal.impl.JavaClassImpl#getAllEvents <em>All Events</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class JavaClassImpl extends EClassImpl implements JavaClass { - - /** - * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getKind() - * @generated - * @ordered - */ - protected static final TypeKind KIND_EDEFAULT = TypeKind.UNDEFINED_LITERAL; - - /** - * @generated This field/method will be replaced during code generation. - */ - /** - * @generated This field/method will be replaced during code generation. - */ - protected TypeKind kind = KIND_EDEFAULT; - - /** - * The default value of the '{@link #isPublic() <em>Public</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isPublic() - * @generated - * @ordered - */ - protected static final boolean PUBLIC_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isPublic() <em>Public</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isPublic() - * @generated - * @ordered - */ - protected static final int PUBLIC_EFLAG = 1 << 10; - - /** - * The default value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final boolean FINAL_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final int FINAL_EFLAG = 1 << 11; - - /** - * The cached value of the '{@link #getImplementsInterfaces() <em>Implements Interfaces</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getImplementsInterfaces() - * @generated - * @ordered - */ - protected EList implementsInterfaces = null; - - /** - * The cached value of the '{@link #getClassImport() <em>Class Import</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getClassImport() - * @generated - * @ordered - */ - protected EList classImport = null; - - /** - * The cached value of the '{@link #getPackageImports() <em>Package Imports</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPackageImports() - * @generated - * @ordered - */ - protected EList packageImports = null; - - /** - * The cached value of the '{@link #getFields() <em>Fields</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getFields() - * @generated - * @ordered - */ - protected EList fields = null; - - /** - * The cached value of the '{@link #getMethods() <em>Methods</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getMethods() - * @generated - * @ordered - */ - protected EList methods = null; - - /** - * The cached value of the '{@link #getInitializers() <em>Initializers</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInitializers() - * @generated - * @ordered - */ - protected EList initializers = null; - - /** - * The cached value of the '{@link #getDeclaredClasses() <em>Declared Classes</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDeclaredClasses() - * @generated - * @ordered - */ - protected EList declaredClasses = null; - - /** - * The cached value of the '{@link #getDeclaringClass() <em>Declaring Class</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDeclaringClass() - * @generated - * @ordered - */ - protected JavaClass declaringClass = null; - - /** - * The cached value of the '{@link #getEvents() <em>Events</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEvents() - * @generated - * @ordered - */ - protected EList events = null; - - protected JavaClassImpl() { - super(); - } - - public EList getEAnnotationsInternal() { - return super.getEAnnotations(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getJavaClass(); - } - - /** - * Protected helper methods. - */ - protected void collectFieldsExtended(List fields) { - fields.addAll(getFields()); - Iterator it; - it = getExtendedLookupIterator(); - while (it.hasNext()) - ((JavaClassImpl) it.next()).collectFieldsExtended(fields); - } - - protected void collectMethodsExtended(Map methods, boolean onlyPublic, List excludedClasses, List excludedMethods) { - Iterator it1, it2; - it2 = getExtendedLookupIterator(); - JavaClassImpl javaClass; - while (it2.hasNext()) { - javaClass = (JavaClassImpl) it2.next(); - if (!excludedClasses.contains(javaClass)) - javaClass.collectMethodsExtended(methods, onlyPublic, excludedClasses, excludedMethods); - } - it1 = onlyPublic ? getPublicMethods().iterator() : getMethods().iterator(); - Method nextMethod; - while (it1.hasNext()) { - nextMethod = (Method) it1.next(); - if (!excludedMethods.contains(nextMethod)) - methods.put(nextMethod.getMethodElementSignature(), nextMethod); - } - } - - /** - * createClassRef - return a JavaURL reference to the named Java class - * - * @deprecated @see org.eclipse.jem.java.JavaRefFactory#createClassRef(java.lang.String) - */ - public static JavaClass createClassRef(String targetName) { - return JavaRefFactory.eINSTANCE.createClassRef(targetName); - } - - /** - * Get the method of this name and these parameters. It will look up the supertype hierarchy. - */ - protected Method findClassMethodExtended(String methodName, List parameterTypes) { - Method method = getMethod(methodName, parameterTypes); - if (method != null) - return method; - else { - JavaClassImpl mySuper; - mySuper = (JavaClassImpl) getSupertype(); - if (mySuper != null) - return mySuper.findClassMethodExtended(methodName, parameterTypes); - } - return null; - } - - /** - * Get the method of this name and these parameters. It will look up the supertype hierarchy. - */ - protected Method findInterfaceMethodExtended(String methodName, List parameterTypes) { - Method method = getMethod(methodName, parameterTypes); - if (method != null) - return method; - else { - JavaClassImpl superInterface; - List list = getImplementsInterfaces(); - for (int i = 0; i < list.size(); i++) { - superInterface = (JavaClassImpl) list.get(i); - method = superInterface.findInterfaceMethodExtended(methodName, parameterTypes); - if (method != null) - return method; - } - } - return null; - } - - /** - * - * @return - * @deprecated If anyone is referencing this, please use getEAllSuperTypes() instead. This was placed here and misspelled by mistake. - */ - public EList getAllSupertypes() { - getESuperTypes(); //Force reflection, if needed, before getting all supertypes. - return super.getEAllSuperTypes(); - } - - /** - * Overrides to perform reflection if necessary - */ - public EList getClassImport() { - reflectBase(); - return getClassImportGen(); - } - - public EList getEAllOperations() { - IIntrospectionAdapter ia = getIntrospectionAdapter(); - if (ia == null) - return super.getEAllOperations(); // No introspection, do normal. - if (eAllOperations == null) - eAllOperations = ia.getEAllOperations(); - return eAllOperations; - } - - /** - * This is not meant to be used by others. It is here so that BeanInfo adapter can access - * un-introspected all operations. - * @return - * - * @since 1.1.0 - */ - public EList primGetEAllOperations() { - return super.getEAllOperations(); - } - - public EList getEOperations() { - IIntrospectionAdapter adapter = getIntrospectionAdapter(); - if (adapter != null) - return adapter.getEOperations(); - return super.getEOperations(); - } - - /** - * This method is not meant to be used by others. It is here so that BeanInfo adapters can go to - * the non-introspected operations. - * @return - * - * @since 1.1.0 - */ - public EList getEOperationsInternal() { - // An internal method for returning actual wo fluffing up. - return super.getEOperations(); - } - - public EList getEAnnotations() { - IIntrospectionAdapter adapter = getIntrospectionAdapter(); - if (adapter != null) - adapter.introspectIfNecessary(); // To cause introspection so the appropriate decorator is added. - return super.getEAnnotations(); - } - - public EList getEStructuralFeatures() { - IIntrospectionAdapter adapter = getIntrospectionAdapter(); - if (adapter != null) - return adapter.getEStructuralFeatures(); - return super.getEStructuralFeatures(); - } - - public EList getEStructuralFeaturesInternal() { - // An internal method for returning actual wo fluffing up. - return super.getEStructuralFeatures(); - } - - /** - * Return an Iterator on the implemntsInferface List if this is an interface class or on the super List if it is a class. - */ - protected Iterator getExtendedLookupIterator() { - if (isInterface()) - return getImplementsInterfaces().iterator(); - else - return getESuperTypes().iterator(); - } - - /** - * Return an Field with the passed name, or null. - */ - public Field getField(String fieldName) { - java.util.List fields = getFields(); - Field field; - for (int i = 0; i < fields.size(); i++) { - field = (Field) fields.get(i); - if (field.getName().equals(fieldName)) - return field; - } - return null; - } - - /** - * Return an Field with the passed name from this JavaClass or any supertypes. - * - * Return null if a Field named fieldName is not found. - */ - public Field getFieldExtended(String fieldName) { - Field field = getFieldNamed(fieldName); - if (field != null) - return field; - Iterator it = getExtendedLookupIterator(); - while (it.hasNext()) { - Field result = ((JavaClass) it.next()).getFieldExtended(fieldName); - if (result != null) - return result; - } - return null; - } - - /** - * Return an Field with the passed name, or null. - */ - public Field getFieldNamed(String fieldName) { - return getField(fieldName); - } - - public EList getFields() { - reflectFields(); - return getFieldsGen(); - } - - /** - * Return all fields, including those from supertypes. - */ - public List getFieldsExtended() { - List fields = new ArrayList(); - collectFieldsExtended(fields); - return fields; - } - - public EList getImplementsInterfaces() { - reflectBase(); - return getImplementsInterfacesGen(); - } - - /** - * Return an IntrospectionAdaptor which can introspect our Java properties - */ - protected synchronized IIntrospectionAdapter getIntrospectionAdapter() { - // Need to sync this because we are now in multi-thread env. - return (IIntrospectionAdapter) EcoreUtil.getRegisteredAdapter(this, IIntrospectionAdapter.ADAPTER_KEY); - } - - public String getJavaName() { - return getQualifiedName(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.java.JavaHelpers#getSimpleName() - */ - public String getSimpleName() { - return primGetName().replace('$', '.'); - } - /** - * getJavaPackage. This is a derived relationship, so we must implement it here to get the EPackage that this object is contained in. - */ - public JavaPackage getJavaPackage() { - return (JavaPackage) getEPackage(); - } - - /** - * Get the method of this name and these parameters. It will not look up the supertype hierarchy. - */ - public Method getMethod(String methodName, List parameterTypes) { - return getMethod(methodName, parameterTypes, getMethods()); - } - - protected Method getMethod(String name, List parameterTypes, List methodList) { - boolean found = false; - Method method; - for (int i = 0; i < methodList.size(); i++) { - method = (Method) methodList.get(i); - JavaParameter[] params; - if (method.getName().equals(name)) { - params = method.listParametersWithoutReturn(); - if (params.length == parameterTypes.size()) { - found = true; //Maybe; we need more info - for (int j = 0; j < params.length; j++) { - //if any one of the parameters doesn't match then flip back to false - JavaHelpers jh = (JavaHelpers) params[j].getEType(); - if (!jh.getQualifiedName().equals(parameterTypes.get(j))) { - found = false; - break; - } // end if params equal - } // end compare all params - if (found) //short circuit out of this loop and return the winner - return method; - } // end compare lengths - } // end compare names - } // end loop through all methodList - return null; - } - - /** - * Return a List of Strings that represent MethodElement signatures from most general to most specific. - */ - public List getMethodElementSignatures() { - List methods, signatures, sameNames; - methods = getMethodsExtended(); - sameNames = new ArrayList(); - signatures = new ArrayList(methods.size() + 1); - signatures.add(DEFAULT_METHOD_NAME); - Iterator it = methods.iterator(); - Method aMethod; - String methodName; - while (it.hasNext()) { - aMethod = (Method) it.next(); - methodName = aMethod.getName(); - if (sameNames.contains(methodName)) { - if (!signatures.contains(methodName)) - signatures.add(methodName); - } else - sameNames.add(methodName); - signatures.add(aMethod.getMethodElementSignature()); - } - Collections.sort(signatures); - return signatures; - } - - /** - * Get the method of this name and these parameters. It will look up the supertype hierarchy. - */ - public Method getMethodExtended(String methodName, List parameterTypes) { - if (isInterface()) - return findInterfaceMethodExtended(methodName, parameterTypes); - else - return findClassMethodExtended(methodName, parameterTypes); - } - - public EList getMethods() { - reflectMethods(); - return getMethodsGen(); - } - - /** - * Return all methods, including those from supertypes. - */ - public List getMethodsExtended() { - Map methods = new HashMap(); - collectMethodsExtended(methods, false, Collections.EMPTY_LIST, Collections.EMPTY_LIST); - return new ArrayList(methods.values()); - } - - /* - * @see getMethodsExtendedWithFilters(List, List) on JavaClass. - */ - public List getMethodsExtendedWithFilters(List excludedClasses, List excludedMethods) { - Map methods = new HashMap(); - collectMethodsExtended(methods, false, excludedClasses, excludedMethods); - return new ArrayList(methods.values()); - } - - public String getName() { - String result = this.primGetName(); - if (result == null && eIsProxy()) { - return JavaRefFactory.eINSTANCE.getTypeName(eProxyURI()); - } - return result; - } - - /** - * Return a List of Methods that begins with @aMethodNamePrefix and is not included in the @excludedNames list. If @aMethodNamePrefix is null, all methods will be returned. - - */ - public List getOnlySpecificMethods(String aMethodNamePrefix, List excludedNames) { - List methods, specific; - methods = getMethodsExtended(); - specific = new ArrayList(methods.size()); - Iterator it = methods.iterator(); - Method aMethod; - String methodName; - while (it.hasNext()) { - aMethod = (Method) it.next(); - methodName = aMethod.getName(); - if (aMethodNamePrefix != null && methodName.startsWith(aMethodNamePrefix) && excludedNames != null && !excludedNames.contains(methodName)) - specific.add(aMethod); - } - return specific; - } - - public EList getPackageImports() { - reflectBase(); - return getPackageImportsGen(); - } - - /** - * getPrimitive method comment. - */ - public JavaDataType getPrimitive() { - String primitiveName = getPrimitiveName(); - if (primitiveName != null) { - Resource res = eResource(); - return (JavaDataType) JavaClassImpl.reflect(primitiveName, res.getResourceSet()); - } - return null; - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaHelpers#getPrimitiveID() - */ - public int getPrimitiveID() { - String myName = getQualifiedName(); - if (myName.equals(INTEGER_NAME)) - return PRIM_INTEGER_ID; - if (myName.equals(BOOLEAN_NAME)) - return PRIM_BOOLEAN_ID; - if (myName.equals(BYTE_NAME)) - return PRIM_BYTE_ID; - if (myName.equals(SHORT_NAME)) - return PRIM_SHORT_ID; - if (myName.equals(LONG_NAME)) - return PRIM_LONG_ID; - if (myName.equals(FLOAT_NAME)) - return PRIM_FLOAT_ID; - if (myName.equals(DOUBLE_NAME)) - return PRIM_DOUBLE_ID; - if (myName.equals(CHARACTER_NAME)) - return PRIM_CHARACTER_ID; - return PRIM_NOT_ID; - } - - /** - * Return the primitive name for this type if one exists. - */ - protected String getPrimitiveName() { - String myName = getQualifiedName(); - if (myName.equals(INTEGER_NAME)) - return PRIM_INTEGER_NAME; - if (myName.equals(BOOLEAN_NAME)) - return PRIM_BOOLEAN_NAME; - if (myName.equals(BYTE_NAME)) - return PRIM_BYTE_NAME; - if (myName.equals(SHORT_NAME)) - return PRIM_SHORT_NAME; - if (myName.equals(LONG_NAME)) - return PRIM_LONG_NAME; - if (myName.equals(FLOAT_NAME)) - return PRIM_FLOAT_NAME; - if (myName.equals(DOUBLE_NAME)) - return PRIM_DOUBLE_NAME; - if (myName.equals(CHARACTER_NAME)) - return PRIM_CHARACTER_NAME; - return null; - } - - /** - * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists. It - * will not look up the supertype hierarchy. - */ - public Method getPublicMethod(String methodName, List parameterTypes) { - return getMethod(methodName, parameterTypes, getPublicMethods()); - } - - /** - * Return a method matching the name, and non-return parameters with fully qualified types matching all the types in the list, if it exists. It - * will not look up the supertype hierarchy. - */ - public Method getPublicMethodExtended(String methodName, List parameterTypes) { - return getMethod(methodName, parameterTypes, getPublicMethodsExtended()); - } - - /** - * Return all methods, it will not go up the supertype hierarchy. - */ - public List getPublicMethods() { - List publicMethods = new ArrayList(); - List theMethods = getMethods(); - for (int i = 0; i < theMethods.size(); i++) { - Method m = (Method) theMethods.get(i); - if (JavaVisibilityKind.PUBLIC_LITERAL == m.getJavaVisibility()) - publicMethods.add(m); - } - return publicMethods; - } - - /** - * Return all public methods, including those from supertypes. - */ - public List getPublicMethodsExtended() { - Map methods = new HashMap(); - collectMethodsExtended(methods, true, Collections.EMPTY_LIST, Collections.EMPTY_LIST); - return new ArrayList(methods.values()); - } - - /** - * Returns a filtered list on the methods of this class, having a name equal to that of the parameter. - */ - public List getPublicMethodsExtendedNamed(String name) { - List publicMethods = new ArrayList(); - List theMethods = getPublicMethodsExtended(); - for (int i = 0; i < theMethods.size(); i++) { - Method m = (Method) theMethods.get(i); - if (m.getName().equals(name)) - publicMethods.add(m); - } - return publicMethods; - } - - /** - * Returns a filtered list on the methods of this class, having a name equal to that of the parameter. - */ - public List getPublicMethodsNamed(String name) { - List publicMethods = new ArrayList(); - List theMethods = getPublicMethods(); - for (int i = 0; i < theMethods.size(); i++) { - Method m = (Method) theMethods.get(i); - if (m.getName().equals(name)) - publicMethods.add(m); - } - return publicMethods; - } - - public String getQualifiedName() { - String result = null; - if (eIsProxy()) { - result = JavaRefFactory.eINSTANCE.getFullTypeName(eProxyURI()); - } else { - result = primGetQualifiedName(); - } - if (result != null) - result = result.replace('$', '.'); - return result; - } - - /** - * To be used by people that need to get the qualified name used for reflection. Typically bean info would need to use something like this. - */ - public String getQualifiedNameForReflection() { - return primGetQualifiedName(); - } - - /** - * Return a ReadAdaptor which can reflect our Java properties - */ - protected synchronized ReadAdaptor getReadAdapter() { - // Need to sync because now in a multi-thread env. - return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY); - } - - private static final int NOT_REFLECTED = 0x0, REFLECTED_BASE = 0x1, REFLECTED_METHODS = 0x2, REFLECTED_FIELDS = 0x4; - - protected int reflectionStatus = NOT_REFLECTED; - - protected void reflectBase() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_BASE) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = readAdaptor.reflectValuesIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - reflectionStatus |= REFLECTED_BASE; - } - } - } - - protected void reflectFields() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_FIELDS) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = ((IJavaClassAdaptor) readAdaptor).reflectFieldsIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - reflectionStatus |= (REFLECTED_FIELDS | REFLECTED_BASE); // We can be certain base will be done by reflect fields if not already - // done. - } - } - } - - protected void reflectMethods() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_METHODS) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = ((IJavaClassAdaptor) readAdaptor).reflectMethodsIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - reflectionStatus |= (REFLECTED_METHODS | REFLECTED_BASE); // We can be certain base will be done by reflect fields if not already - // done. - } - } - } - - public JavaClass getSupertype() { - // If this is an interface, there is no supertype. However, the eSuperTypes IS filled in with any interface that this extends. - if (isInterface()) - return null; - List list = getESuperTypes(); - return (!list.isEmpty()) ? (JavaClass) list.get(0) : null; - } - - public JavaClass getWrapper() { - return this; - } - - /** - * Test whether the receiver implements the passed interface (or one of its supertypes). - */ - public boolean implementsInterface(JavaClass interfaceType) { - if (this == interfaceType) - return true; - EList implemented = getImplementsInterfaces(); - JavaClass anInterface; - for (int i = 0; i < implemented.size(); i++) { - anInterface = (JavaClass) implemented.get(i); - if (anInterface.implementsInterface(interfaceType)) - return true; - } - if (getSupertype() != null) - return getSupertype().implementsInterface(interfaceType); - else - return false; - } - - /** - * Return a string showing our details. - */ - public String infoString() { - StringBuffer out = new StringBuffer(); - // trip class reflection - //FB this.eGet(JavaRefPackage.eINSTANCE.getJavaClass_Public()); - reflectBase(); //FB - out.append("Java class: " + getQualifiedName() + "\n"); - out.append(" superclass: " + this.getSupertype() + "\n"); - EList fields = getFields(); - Field field; - if (fields.size() > 0) { - out.append(" Fields:\n"); - for (int i = 0; i < fields.size(); i++) { - field = (Field) fields.get(i); - out.append(" " + ((JavaHelpers) field.getEType()).getJavaName() + " " + field.getName() + "\n"); - } - } - EList methods = getMethods(); - Method method; - if (methods.size() > 0) { - out.append(" Methods:\n"); - for (int i = 0; i < methods.size(); i++) { - method = (Method) methods.get(i); - // trip method reflection - method.isStatic(); - if (method.getReturnType() != null) - out.append(" " + method.getReturnType().getJavaName() + " "); - else - out.append(" void "); - out.append(method.getName() + "("); - EList parms = method.getParameters(); - JavaParameter parm; - if (parms.size() > 0) { - for (int ii = 0; ii < parms.size(); ii++) { - parm = (JavaParameter) parms.get(ii); - //FB if (!parm.isReturn()) { - out.append(((JavaHelpers) parm.getEType()).getJavaName() + " " + parm.getName()); - if (ii < parms.size() - 1) - out.append(", "); - //FB } - } - } - out.append(")\n"); - } - } - return out.toString(); - } - - /** - * Tests whether this class inherits from the passed in class. - */ - public boolean inheritsFrom(JavaClass javaClass) { - if (this == javaClass) - return true; - else if (getSupertype() != null) - return getSupertype().inheritsFrom(javaClass); - else - return false; - } - - public boolean isArray() { - return false; - } - - /** - * Can an object of the passed in class be assigned to an object of this class. In other words is this class a supertype of the passed in class, - * or is it superinterface of it. - */ - public boolean isAssignableFrom(EClassifier aClass) { - if (aClass instanceof JavaClass) { - JavaClass theClass = (JavaClass) aClass; - // If either this class or aClass kind is unknown then it isn't assignableFrom. - if (getKind() == TypeKind.UNDEFINED_LITERAL || theClass.getKind() == TypeKind.UNDEFINED_LITERAL) - return false; - // If the "aClass" is not a JavaClass (i.e. it is either a JavaDatatype or - // some other kind of MOF classifier), then it cannot be - // assigned to something of this class. - if (getKind() != TypeKind.INTERFACE_LITERAL) - if (theClass.getKind() != TypeKind.INTERFACE_LITERAL) - return theClass.inheritsFrom(this); - else { - // aClass is an interface, so it is assignable only if - // "this" is "java.lang.Object". - return getQualifiedName().equals("java.lang.Object"); - } - else - return theClass.implementsInterface(this); - } - return false; - } - - /** - * Does this type exist. - */ - public boolean isExistingType() { - // TODO: Temporary, inefficient implementation - return ((JavaReflectionAdaptor) getReadAdapter()).hasReflectionSource(); - } - - /** - * See if this is valid object of this type. - */ - public boolean isInstance(Object o) { - return o instanceof IInstantiationInstance ? isAssignableFrom(((IInstantiationInstance) o).getJavaType()) : false; - } - - /** - * Is this an interface. - */ - public boolean isInterface() { - return getKind() == TypeKind.INTERFACE_LITERAL; - } - - public boolean isNested() { - return getDeclaringClass() != null; - } - - public boolean isPrimitive() { - return false; - } - - /** - * Return an array listing our fields, including inherited fields. The field relationship is derived from contents. This implementation depends on - * the assumption that supertypes above JavaClass will hold Attributes rather than Fields. - */ - public Field[] listFieldExtended() { - List fields = getFieldsExtended(); - Field[] result = new Field[fields.size()]; - fields.toArray(result); - return result; - } - - /** - * Return an array listing our Methods, including inherited methods. The method relationship is derived from contents. This implementation depends - * on the assumption that supertypes above JavaClass will hold Operations rather than Methods. - */ - public Method[] listMethodExtended() { - java.util.List methods = getMethodsExtended(); - Method[] result = new Method[methods.size()]; - methods.toArray(result); - return result; - } - - /** - * This is required for internal reflection do not use. - */ - public String primGetName() { - return super.getName(); - } - - /** - * This is required for internal reflection do not use. - */ - public String primGetQualifiedName() { - String result = ""; - if (eIsProxy()) { - result = JavaRefFactory.eINSTANCE.getFullTypeName(eProxyURI()); - } else { - JavaPackage pack = getJavaPackage(); - if (pack != null && pack.getPackageName().length() != 0) - result = pack.getPackageName() + "." + ((JavaRefFactoryImpl) JavaRefFactory.eINSTANCE).primGetTypeName(this.primGetName()); - else - result = this.getName(); - } - return result; - } - - /** - * reflect - reflect a JavaClass for a given qualified name. If the package or class does not exist, one will be created through the reflection - * mechanism. Lookup the JavaClass in the context of the passed object, handling some error cases. - * - * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.EObject) - * - */ - public static JavaHelpers reflect(String aQualifiedName, EObject relatedObject) { - return JavaRefFactory.eINSTANCE.reflectType(aQualifiedName, relatedObject); - } - - /** - * reflect - reflect a JavaClass for a given qualified name. If the package or class does not exist, one will be created through the reflection - * mechanism. - * - * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet) - */ - public static JavaHelpers reflect(String aQualifiedName, ResourceSet set) { - return JavaRefFactory.eINSTANCE.reflectType(aQualifiedName, set); - } - - /** - * reflect - reflect a JavaClass for a given package name or class name. If the package or class does not exist, one will be created through the - * reflection mechanism. - * - * @deprecated @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, java.lang.String, - * org.eclipse.emf.ecore.resource.ResourceSet) - */ - public static JavaHelpers reflect(String aPackageName, String aClassName, ResourceSet set) { - return JavaRefFactory.eINSTANCE.reflectType(aPackageName, aClassName, set); - } - - public void setSupertype(JavaClass aJavaClass) throws InheritanceCycleException { - validateSupertype(aJavaClass); - List s = super.getESuperTypes(); - s.clear(); - if (aJavaClass != null) - s.add(aJavaClass); - } - - /** - * Check to make sure that the passed JavaClass is a valid super class (i.e., it does not create any cycles in the inheritance. - * - * @param aJavaClass - */ - protected void validateSupertype(JavaClass aJavaClass) throws InheritanceCycleException { - if (!isValidSupertype(aJavaClass)) - throw new InheritanceCycleException(this, aJavaClass); - } - - public boolean isValidSupertype(JavaClass aJavaClass) { - if (aJavaClass != null) { - if (this.equals(aJavaClass)) - return false; - return extendedIsValidSupertype(getSubtypes(), aJavaClass); - } - return true; - } - - /** - * @param subtypes - * @param aJavaClass - */ - private boolean extendedIsValidSupertype(List subtypes, JavaClass aJavaClass) { - if (!basicIsValidSupertype(subtypes, aJavaClass)) - return false; - JavaClass subtype; - for (int i = 0; i < subtypes.size(); i++) { - subtype = (JavaClass) subtypes.get(i); - if (!subtype.isValidSupertype(aJavaClass)) - return false; - } - return true; - } - - private boolean basicIsValidSupertype(List subtypes, JavaClass aJavaClass) { - JavaClass subtype; - for (int i = 0; i < subtypes.size(); i++) { - subtype = (JavaClass) subtypes.get(i); - if (subtype.equals(aJavaClass)) - return false; - } - return true; - } - - protected List getSubtypes() { - return getESuperAdapter().getSubclasses(); - } - - public String toString() { - return getClass().getName() + "(" + getQualifiedName() + ")"; - } - - public TypeKind getKind() { - reflectBase(); - return getKindGen(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setKind(TypeKind newKind) { - TypeKind oldKind = kind; - kind = newKind == null ? KIND_EDEFAULT : newKind; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__KIND, oldKind, kind)); - } - - public boolean isPublic() { - reflectBase(); - return isPublicGen(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setPublic(boolean newPublic) { - boolean oldPublic = (eFlags & PUBLIC_EFLAG) != 0; - if (newPublic) eFlags |= PUBLIC_EFLAG; else eFlags &= ~PUBLIC_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__PUBLIC, oldPublic, newPublic)); - } - - public boolean isFinal() { - reflectBase(); - return isFinalGen(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFinal(boolean newFinal) { - boolean oldFinal = (eFlags & FINAL_EFLAG) != 0; - if (newFinal) eFlags |= FINAL_EFLAG; else eFlags &= ~FINAL_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__FINAL, oldFinal, newFinal)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TypeKind getKindGen() { - return kind; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isPublicGen() { - return (eFlags & PUBLIC_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isFinalGen() { - return (eFlags & FINAL_EFLAG) != 0; - } - - public EList getInitializers() { - if (initializers == null) { - initializers = new EObjectContainmentWithInverseEList(Initializer.class, this, JavaRefPackage.JAVA_CLASS__INITIALIZERS, - JavaRefPackage.INITIALIZER__JAVA_CLASS); - } - return initializers; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDeclaringClass(JavaClass newDeclaringClass) { - if (newDeclaringClass != declaringClass) { - NotificationChain msgs = null; - if (declaringClass != null) - msgs = ((InternalEObject)declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs); - if (newDeclaringClass != null) - msgs = ((InternalEObject)newDeclaringClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs); - msgs = basicSetDeclaringClass(newDeclaringClass, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, newDeclaringClass, newDeclaringClass)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaClass getDeclaringClass() { - if (declaringClass != null && declaringClass.eIsProxy()) { - JavaClass oldDeclaringClass = declaringClass; - declaringClass = (JavaClass)eResolveProxy((InternalEObject)declaringClass); - if (declaringClass != oldDeclaringClass) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, oldDeclaringClass, declaringClass)); - } - } - return declaringClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaClass basicGetDeclaringClass() { - return declaringClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetDeclaringClass(JavaClass newDeclaringClass, NotificationChain msgs) { - JavaClass oldDeclaringClass = declaringClass; - declaringClass = newDeclaringClass; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS, oldDeclaringClass, newDeclaringClass); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - public EList getDeclaredClasses() { - reflectBase(); - return getDeclaredClassesGen(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getDeclaredClassesGen() { - if (declaredClasses == null) { - declaredClasses = new EObjectWithInverseResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaRefPackage.JAVA_CLASS__DECLARING_CLASS); - } - return declaredClasses; - } - - public EList getProperties() { - return getEStructuralFeatures(); // As of EMF 2.0, local properties are the local features. Used to be a merge of eattributes and ereferences. - } - - public EList getEvents() { - IIntrospectionAdapter adapter = getIntrospectionAdapter(); - if (adapter != null) - return adapter.getEvents(); - return getEventsGen(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getEventsGen() { - if (events == null) { - events = new EObjectContainmentEList(JavaEvent.class, this, JavaRefPackage.JAVA_CLASS__EVENTS); - } - return events; - } - - private EList allEvents; - - public EList getAllEvents() { - IIntrospectionAdapter ia = getIntrospectionAdapter(); - if (ia == null) - return ECollections.EMPTY_ELIST; // No introspection, do normal. - return allEvents = ia.getAllEvents(); - } - - public EList getAllEventsGen() { - return allEvents; - } - - private EList allProperties; - - public EList getAllProperties() { - IIntrospectionAdapter ia = getIntrospectionAdapter(); - if (ia == null) - return ECollections.EMPTY_ELIST; // No introspection, do normal. - return allProperties = ia.getAllProperties(); - } - - public EList getAllPropertiesGen() { - return allProperties; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.JAVA_CLASS__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS_NAME: - return INSTANCE_CLASS_NAME_EDEFAULT == null ? instanceClassName != null : !INSTANCE_CLASS_NAME_EDEFAULT.equals(instanceClassName); - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS: - return INSTANCE_CLASS_EDEFAULT == null ? getInstanceClass() != null : !INSTANCE_CLASS_EDEFAULT.equals(getInstanceClass()); - case JavaRefPackage.JAVA_CLASS__DEFAULT_VALUE: - return DEFAULT_VALUE_EDEFAULT == null ? getDefaultValue() != null : !DEFAULT_VALUE_EDEFAULT.equals(getDefaultValue()); - case JavaRefPackage.JAVA_CLASS__EPACKAGE: - return getEPackage() != null; - case JavaRefPackage.JAVA_CLASS__ABSTRACT: - return ((eFlags & ABSTRACT_EFLAG) != 0) != ABSTRACT_EDEFAULT; - case JavaRefPackage.JAVA_CLASS__INTERFACE: - return ((eFlags & INTERFACE_EFLAG) != 0) != INTERFACE_EDEFAULT; - case JavaRefPackage.JAVA_CLASS__ESUPER_TYPES: - return eSuperTypes != null && !eSuperTypes.isEmpty(); - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - return eOperations != null && !eOperations.isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_ATTRIBUTES: - return !getEAllAttributes().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_REFERENCES: - return !getEAllReferences().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EREFERENCES: - return !getEReferences().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EATTRIBUTES: - return !getEAttributes().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_CONTAINMENTS: - return !getEAllContainments().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_OPERATIONS: - return !getEAllOperations().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_STRUCTURAL_FEATURES: - return !getEAllStructuralFeatures().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EALL_SUPER_TYPES: - return !getEAllSuperTypes().isEmpty(); - case JavaRefPackage.JAVA_CLASS__EID_ATTRIBUTE: - return getEIDAttribute() != null; - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - return eStructuralFeatures != null && !eStructuralFeatures.isEmpty(); - case JavaRefPackage.JAVA_CLASS__KIND: - return kind != KIND_EDEFAULT; - case JavaRefPackage.JAVA_CLASS__PUBLIC: - return ((eFlags & PUBLIC_EFLAG) != 0) != PUBLIC_EDEFAULT; - case JavaRefPackage.JAVA_CLASS__FINAL: - return ((eFlags & FINAL_EFLAG) != 0) != FINAL_EDEFAULT; - case JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES: - return implementsInterfaces != null && !implementsInterfaces.isEmpty(); - case JavaRefPackage.JAVA_CLASS__CLASS_IMPORT: - return classImport != null && !classImport.isEmpty(); - case JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS: - return packageImports != null && !packageImports.isEmpty(); - case JavaRefPackage.JAVA_CLASS__FIELDS: - return fields != null && !fields.isEmpty(); - case JavaRefPackage.JAVA_CLASS__METHODS: - return methods != null && !methods.isEmpty(); - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - return initializers != null && !initializers.isEmpty(); - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - return declaredClasses != null && !declaredClasses.isEmpty(); - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - return declaringClass != null; - case JavaRefPackage.JAVA_CLASS__JAVA_PACKAGE: - return basicGetJavaPackage() != null; - case JavaRefPackage.JAVA_CLASS__EVENTS: - return events != null && !events.isEmpty(); - case JavaRefPackage.JAVA_CLASS__ALL_EVENTS: - return !getAllEvents().isEmpty(); - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__NAME: - setName((String)newValue); - return; - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS_NAME: - setInstanceClassName((String)newValue); - return; - case JavaRefPackage.JAVA_CLASS__ABSTRACT: - setAbstract(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_CLASS__INTERFACE: - setInterface(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_CLASS__ESUPER_TYPES: - getESuperTypes().clear(); - getESuperTypes().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - getEOperations().clear(); - getEOperations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - getEStructuralFeatures().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__KIND: - setKind((TypeKind)newValue); - return; - case JavaRefPackage.JAVA_CLASS__PUBLIC: - setPublic(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_CLASS__FINAL: - setFinal(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES: - getImplementsInterfaces().clear(); - getImplementsInterfaces().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__CLASS_IMPORT: - getClassImport().clear(); - getClassImport().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS: - getPackageImports().clear(); - getPackageImports().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__FIELDS: - getFields().clear(); - getFields().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__METHODS: - getMethods().clear(); - getMethods().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - getInitializers().clear(); - getInitializers().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - getDeclaredClasses().clear(); - getDeclaredClasses().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - setDeclaringClass((JavaClass)newValue); - return; - case JavaRefPackage.JAVA_CLASS__EVENTS: - getEvents().clear(); - getEvents().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_CLASS__ALL_EVENTS: - getAllEvents().clear(); - getAllEvents().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.JAVA_CLASS__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS_NAME: - setInstanceClassName(INSTANCE_CLASS_NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__ABSTRACT: - setAbstract(ABSTRACT_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__INTERFACE: - setInterface(INTERFACE_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__ESUPER_TYPES: - getESuperTypes().clear(); - return; - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - getEOperations().clear(); - return; - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - return; - case JavaRefPackage.JAVA_CLASS__KIND: - setKind(KIND_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__PUBLIC: - setPublic(PUBLIC_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__FINAL: - setFinal(FINAL_EDEFAULT); - return; - case JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES: - getImplementsInterfaces().clear(); - return; - case JavaRefPackage.JAVA_CLASS__CLASS_IMPORT: - getClassImport().clear(); - return; - case JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS: - getPackageImports().clear(); - return; - case JavaRefPackage.JAVA_CLASS__FIELDS: - getFields().clear(); - return; - case JavaRefPackage.JAVA_CLASS__METHODS: - getMethods().clear(); - return; - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - getInitializers().clear(); - return; - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - getDeclaredClasses().clear(); - return; - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - setDeclaringClass((JavaClass)null); - return; - case JavaRefPackage.JAVA_CLASS__EVENTS: - getEvents().clear(); - return; - case JavaRefPackage.JAVA_CLASS__ALL_EVENTS: - getAllEvents().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - */ - public EList getImplementsInterfacesGen() { - if (implementsInterfaces == null) { - implementsInterfaces = new EObjectResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES) { - - /** - * Comment for <code>serialVersionUID</code> - * - * @since 1.1.0 - */ - private static final long serialVersionUID = 1L; - - public Object get(int index) { - if (isInterface()) - getInterfaceSuperTypes().get(index); //force resolution so the ESuperAdapter will be updated correctly - return super.get(index); - } - - public void clear() { - super.clear(); - if (isInterface()) - getInterfaceSuperTypes().clear(); - } - - public Object remove(int index) { - Object result = super.remove(index); - if (isInterface()) - getInterfaceSuperTypes().remove(index); - return result; - - } - - public boolean removeAll(Collection collection) { - boolean result = super.removeAll(collection); - if (isInterface()) - getInterfaceSuperTypes().removeAll(collection); - return result; - } - - public void add(int index, Object object) { - super.add(index, object); - if (isInterface()) - getInterfaceSuperTypes().add(index, object); - } - - public boolean add(Object object) { - boolean result = super.add(object); - if (isInterface()) - getInterfaceSuperTypes().add(object); - return result; - } - - public boolean addAll(Collection collection) { - boolean result = super.addAll(collection); - if (isInterface()) - getInterfaceSuperTypes().addAll(collection); - return result; - } - - public boolean addAll(int index, Collection collection) { - boolean result = super.addAll(index, collection); - if (isInterface()) - getInterfaceSuperTypes().addAll(index, collection); - return result; - } - }; - } - return implementsInterfaces; - } - - private EList getInterfaceSuperTypes() { - return super.getESuperTypes(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getClassImportGen() { - if (classImport == null) { - classImport = new EObjectResolvingEList(JavaClass.class, this, JavaRefPackage.JAVA_CLASS__CLASS_IMPORT); - } - return classImport; - } - - public EList getEAllSuperTypes() { - reflectBase();//Force reflection, if needed, before getting all supertypes. - return super.getEAllSuperTypes(); - } - - public EList getESuperTypes() { - reflectBase(); - return super.getESuperTypes(); - } - - /** - * This method is not meant to be used by others. It is here so that the reflection - * adapters can reference the unreflected supertypes. - * - * @return - * - * @since 1.1.0 - */ - public EList primGetESuperTypes() { - return super.getESuperTypes(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getPackageImportsGen() { - if (packageImports == null) { - packageImports = new EObjectResolvingEList(JavaPackage.class, this, JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS); - } - return packageImports; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getFieldsGen() { - if (fields == null) { - fields = new EObjectContainmentWithInverseEList(Field.class, this, JavaRefPackage.JAVA_CLASS__FIELDS, JavaRefPackage.FIELD__JAVA_CLASS); - } - return fields; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getMethodsGen() { - if (methods == null) { - methods = new EObjectContainmentWithInverseEList(Method.class, this, JavaRefPackage.JAVA_CLASS__METHODS, JavaRefPackage.METHOD__JAVA_CLASS); - } - return methods; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaPackage getJavaPackageGen() { - JavaPackage javaPackage = basicGetJavaPackage(); - return javaPackage == null ? null : (JavaPackage)eResolveProxy((InternalEObject)javaPackage); - } - - /* - * <!-- begin-user-doc --> <!-- end-user-doc --> - */ - public JavaPackage basicGetJavaPackage() { - return getJavaPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__EPACKAGE: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_CLASS__EPACKAGE, msgs); - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - return ((InternalEList)getEOperations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__FIELDS: - return ((InternalEList)getFields()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__METHODS: - return ((InternalEList)getMethods()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - return ((InternalEList)getInitializers()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - return ((InternalEList)getDeclaredClasses()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - if (declaringClass != null) - msgs = ((InternalEObject)declaringClass).eInverseRemove(this, JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES, JavaClass.class, msgs); - return basicSetDeclaringClass((JavaClass)otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__EPACKAGE: - return eBasicSetContainer(null, JavaRefPackage.JAVA_CLASS__EPACKAGE, msgs); - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - return ((InternalEList)getEOperations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__FIELDS: - return ((InternalEList)getFields()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__METHODS: - return ((InternalEList)getMethods()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - return ((InternalEList)getInitializers()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - return ((InternalEList)getDeclaredClasses()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - return basicSetDeclaringClass(null, msgs); - case JavaRefPackage.JAVA_CLASS__EVENTS: - return ((InternalEList)getEvents()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.JAVA_CLASS__EPACKAGE: - return eContainer.eInverseRemove(this, EcorePackage.EPACKAGE__ECLASSIFIERS, EPackage.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_CLASS__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.JAVA_CLASS__NAME: - return getName(); - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS_NAME: - return getInstanceClassName(); - case JavaRefPackage.JAVA_CLASS__INSTANCE_CLASS: - return getInstanceClass(); - case JavaRefPackage.JAVA_CLASS__DEFAULT_VALUE: - return getDefaultValue(); - case JavaRefPackage.JAVA_CLASS__EPACKAGE: - return getEPackage(); - case JavaRefPackage.JAVA_CLASS__ABSTRACT: - return isAbstract() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_CLASS__INTERFACE: - return isInterface() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_CLASS__ESUPER_TYPES: - return getESuperTypes(); - case JavaRefPackage.JAVA_CLASS__EOPERATIONS: - return getEOperations(); - case JavaRefPackage.JAVA_CLASS__EALL_ATTRIBUTES: - return getEAllAttributes(); - case JavaRefPackage.JAVA_CLASS__EALL_REFERENCES: - return getEAllReferences(); - case JavaRefPackage.JAVA_CLASS__EREFERENCES: - return getEReferences(); - case JavaRefPackage.JAVA_CLASS__EATTRIBUTES: - return getEAttributes(); - case JavaRefPackage.JAVA_CLASS__EALL_CONTAINMENTS: - return getEAllContainments(); - case JavaRefPackage.JAVA_CLASS__EALL_OPERATIONS: - return getEAllOperations(); - case JavaRefPackage.JAVA_CLASS__EALL_STRUCTURAL_FEATURES: - return getEAllStructuralFeatures(); - case JavaRefPackage.JAVA_CLASS__EALL_SUPER_TYPES: - return getEAllSuperTypes(); - case JavaRefPackage.JAVA_CLASS__EID_ATTRIBUTE: - return getEIDAttribute(); - case JavaRefPackage.JAVA_CLASS__ESTRUCTURAL_FEATURES: - return getEStructuralFeatures(); - case JavaRefPackage.JAVA_CLASS__KIND: - return getKind(); - case JavaRefPackage.JAVA_CLASS__PUBLIC: - return isPublic() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_CLASS__FINAL: - return isFinal() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_CLASS__IMPLEMENTS_INTERFACES: - return getImplementsInterfaces(); - case JavaRefPackage.JAVA_CLASS__CLASS_IMPORT: - return getClassImport(); - case JavaRefPackage.JAVA_CLASS__PACKAGE_IMPORTS: - return getPackageImports(); - case JavaRefPackage.JAVA_CLASS__FIELDS: - return getFields(); - case JavaRefPackage.JAVA_CLASS__METHODS: - return getMethods(); - case JavaRefPackage.JAVA_CLASS__INITIALIZERS: - return getInitializers(); - case JavaRefPackage.JAVA_CLASS__DECLARED_CLASSES: - return getDeclaredClasses(); - case JavaRefPackage.JAVA_CLASS__DECLARING_CLASS: - if (resolve) return getDeclaringClass(); - return basicGetDeclaringClass(); - case JavaRefPackage.JAVA_CLASS__JAVA_PACKAGE: - if (resolve) return getJavaPackage(); - return basicGetJavaPackage(); - case JavaRefPackage.JAVA_CLASS__EVENTS: - return getEvents(); - case JavaRefPackage.JAVA_CLASS__ALL_EVENTS: - return getAllEvents(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toStringGen() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (kind: "); - result.append(kind); - result.append(", public: "); - result.append((eFlags & PUBLIC_EFLAG) != 0); - result.append(", final: "); - result.append((eFlags & FINAL_EFLAG) != 0); - result.append(')'); - return result.toString(); - } - - /* - * This should never be called with true. It is basically only for reset of reflection, not to set a particular state. But InternalReadAdaptable - * may be used by someone that shouldn't so to be be safe we keep it. TODO Remove InternalReadAdaptable in next version. Need to wait because we - * need time to notify everyone. - * - * @see org.eclipse.jem.java.adapters.InternalReadAdaptable#setReflected(boolean) - */ - public synchronized void setReflected(boolean aBoolean) { - if (!aBoolean) - reflectionStatus = NOT_REFLECTED; - } - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaClass#getReflectionType() - */ - public Object getReflectionType() { - JavaReflectionAdaptor ja = ((JavaReflectionAdaptor) getReadAdapter()); - return ja != null ? ja.getReflectionSource() : null; - } -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaDataTypeImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaDataTypeImpl.java deleted file mode 100644 index f5e2ede55..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaDataTypeImpl.java +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: JavaDataTypeImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EClassImpl; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.*; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaDataType; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.internal.java.instantiation.IInstantiationInstance; -/** - * @generated - */ -public class JavaDataTypeImpl extends EClassImpl implements JavaDataType{ - - - static final String FALSE = "false"; - static final String DOUBLE_ZERO = "0.0"; - static final String FLOAT_ZERO = "0.0f"; - static final String CHAR_ZERO = "'0'"; - static final String ZERO = "0"; - - private int primitive_type = PRIM_NOT_ID; - - protected JavaDataTypeImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getJavaDataType(); - } - - /** - * Return the default string representing the default value of the primitive. - */ - public String getDefaultValueString() { - String typeName = getJavaName(); - if (typeName.equals(PRIM_BOOLEAN_NAME)) - return FALSE; - if (typeName.equals(PRIM_DOUBLE_NAME)) - return DOUBLE_ZERO; - if (typeName.equals(PRIM_FLOAT_NAME)) - return FLOAT_ZERO; - if (typeName.equals(PRIM_CHARACTER_NAME)) - return CHAR_ZERO; - return ZERO; - } - public String getJavaName() { - return getName(); - } - public JavaDataType getPrimitive() { - return this; - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaHelpers#getPrimitiveID() - */ - public int getPrimitiveID() { - if (primitive_type == PRIM_NOT_ID) { - String name = getName(); - if (name.equals(PRIM_BOOLEAN_NAME)) - primitive_type = PRIM_BOOLEAN_ID; - if (name.equals(PRIM_CHARACTER_NAME)) - primitive_type = PRIM_CHARACTER_ID; - if (name.equals(PRIM_BYTE_NAME)) - primitive_type = PRIM_BYTE_ID; - if (name.equals(PRIM_SHORT_NAME)) - primitive_type = PRIM_SHORT_ID; - if (name.equals(PRIM_INTEGER_NAME)) - primitive_type = PRIM_INTEGER_ID; - if (name.equals(PRIM_LONG_NAME)) - primitive_type = PRIM_LONG_ID; - if (name.equals(PRIM_FLOAT_NAME)) - primitive_type = PRIM_FLOAT_ID; - if (name.equals(PRIM_DOUBLE_NAME)) - primitive_type = PRIM_DOUBLE_ID; - } - return primitive_type; - } - - public String getSimpleName() { - return getName(); - } - public String getQualifiedName() { - return getJavaName(); - } - public JavaClass getWrapper() { - String wrapperName = getWrapperQualifiedName(); - if (wrapperName != null) { - return (JavaClass) JavaRefFactory.eINSTANCE.reflectType(wrapperName, this); - } - return null; - } - /** - * getWrapper method comment. - */ - protected String getWrapperQualifiedName() { - switch (getPrimitiveID()) { - case PRIM_INTEGER_ID: - return INTEGER_NAME; - case PRIM_CHARACTER_ID: - return CHARACTER_NAME; - case PRIM_BOOLEAN_ID: - return BOOLEAN_NAME; - case PRIM_BYTE_ID: - return BYTE_NAME; - case PRIM_SHORT_ID: - return SHORT_NAME; - case PRIM_LONG_ID: - return LONG_NAME; - case PRIM_FLOAT_ID: - return FLOAT_NAME; - case PRIM_DOUBLE_ID: - return DOUBLE_NAME; - default: - return null; - } - } - /* - * JavaHelpers.isArray() - array types are always JavaClasses, even if their component type is - * a primitive data type. Return false. - */ - public boolean isArray() { - return false; - } - /** - * Can an object of the passed in class be assigned to an - * object of this class? In the case of primitives, are they the same. - */ - public boolean isAssignableFrom(EClassifier aClass) { - return this == aClass; - } - /** - * See if this is valid object of this type. - */ - public boolean isInstance(Object o) { - return o instanceof IInstantiationInstance ? isAssignableFrom(((IInstantiationInstance) o).getJavaType()) : false; - } - public boolean isPrimitive() { - return true; - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - return ((InternalEList)getEOperations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicAdd(otherEnd, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE: - return eBasicSetContainer(null, JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - return ((InternalEList)getEOperations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - return ((InternalEList)getEStructuralFeatures()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE: - return eContainer.eInverseRemove(this, EcorePackage.EPACKAGE__ECLASSIFIERS, EPackage.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.JAVA_DATA_TYPE__NAME: - return getName(); - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS_NAME: - return getInstanceClassName(); - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS: - return getInstanceClass(); - case JavaRefPackage.JAVA_DATA_TYPE__DEFAULT_VALUE: - return getDefaultValue(); - case JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE: - return getEPackage(); - case JavaRefPackage.JAVA_DATA_TYPE__ABSTRACT: - return isAbstract() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_DATA_TYPE__INTERFACE: - return isInterface() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_DATA_TYPE__ESUPER_TYPES: - return getESuperTypes(); - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - return getEOperations(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_ATTRIBUTES: - return getEAllAttributes(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_REFERENCES: - return getEAllReferences(); - case JavaRefPackage.JAVA_DATA_TYPE__EREFERENCES: - return getEReferences(); - case JavaRefPackage.JAVA_DATA_TYPE__EATTRIBUTES: - return getEAttributes(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_CONTAINMENTS: - return getEAllContainments(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_OPERATIONS: - return getEAllOperations(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_STRUCTURAL_FEATURES: - return getEAllStructuralFeatures(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_SUPER_TYPES: - return getEAllSuperTypes(); - case JavaRefPackage.JAVA_DATA_TYPE__EID_ATTRIBUTE: - return getEIDAttribute(); - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - return getEStructuralFeatures(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_DATA_TYPE__NAME: - setName((String)newValue); - return; - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS_NAME: - setInstanceClassName((String)newValue); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ABSTRACT: - setAbstract(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_DATA_TYPE__INTERFACE: - setInterface(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ESUPER_TYPES: - getESuperTypes().clear(); - getESuperTypes().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - getEOperations().clear(); - getEOperations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - getEStructuralFeatures().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.JAVA_DATA_TYPE__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS_NAME: - setInstanceClassName(INSTANCE_CLASS_NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ABSTRACT: - setAbstract(ABSTRACT_EDEFAULT); - return; - case JavaRefPackage.JAVA_DATA_TYPE__INTERFACE: - setInterface(INTERFACE_EDEFAULT); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ESUPER_TYPES: - getESuperTypes().clear(); - return; - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - getEOperations().clear(); - return; - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - getEStructuralFeatures().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_DATA_TYPE__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS_NAME: - return INSTANCE_CLASS_NAME_EDEFAULT == null ? instanceClassName != null : !INSTANCE_CLASS_NAME_EDEFAULT.equals(instanceClassName); - case JavaRefPackage.JAVA_DATA_TYPE__INSTANCE_CLASS: - return INSTANCE_CLASS_EDEFAULT == null ? getInstanceClass() != null : !INSTANCE_CLASS_EDEFAULT.equals(getInstanceClass()); - case JavaRefPackage.JAVA_DATA_TYPE__DEFAULT_VALUE: - return DEFAULT_VALUE_EDEFAULT == null ? getDefaultValue() != null : !DEFAULT_VALUE_EDEFAULT.equals(getDefaultValue()); - case JavaRefPackage.JAVA_DATA_TYPE__EPACKAGE: - return getEPackage() != null; - case JavaRefPackage.JAVA_DATA_TYPE__ABSTRACT: - return ((eFlags & ABSTRACT_EFLAG) != 0) != ABSTRACT_EDEFAULT; - case JavaRefPackage.JAVA_DATA_TYPE__INTERFACE: - return ((eFlags & INTERFACE_EFLAG) != 0) != INTERFACE_EDEFAULT; - case JavaRefPackage.JAVA_DATA_TYPE__ESUPER_TYPES: - return eSuperTypes != null && !eSuperTypes.isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EOPERATIONS: - return eOperations != null && !eOperations.isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_ATTRIBUTES: - return !getEAllAttributes().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_REFERENCES: - return !getEAllReferences().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EREFERENCES: - return !getEReferences().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EATTRIBUTES: - return !getEAttributes().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_CONTAINMENTS: - return !getEAllContainments().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_OPERATIONS: - return !getEAllOperations().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_STRUCTURAL_FEATURES: - return !getEAllStructuralFeatures().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EALL_SUPER_TYPES: - return !getEAllSuperTypes().isEmpty(); - case JavaRefPackage.JAVA_DATA_TYPE__EID_ATTRIBUTE: - return getEIDAttribute() != null; - case JavaRefPackage.JAVA_DATA_TYPE__ESTRUCTURAL_FEATURES: - return eStructuralFeatures != null && !eStructuralFeatures.isEmpty(); - } - return eDynamicIsSet(eFeature); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaHelpers#getQualifiedNameForReflection() - */ - public String getQualifiedNameForReflection() { - return getJavaName(); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaEventImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaEventImpl.java deleted file mode 100644 index 217c1ec5f..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaEventImpl.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: JavaEventImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.JavaEvent; -import org.eclipse.jem.java.JavaRefPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Java Event</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public abstract class JavaEventImpl extends EStructuralFeatureImpl implements JavaEvent { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JavaEventImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getJavaEvent(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS: - return eBasicSetContainer(null, JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS: - return eContainer.eInverseRemove(this, EcorePackage.ECLASS__ESTRUCTURAL_FEATURES, EClass.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.JAVA_EVENT__NAME: - return getName(); - case JavaRefPackage.JAVA_EVENT__ORDERED: - return isOrdered() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__UNIQUE: - return isUnique() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__LOWER_BOUND: - return new Integer(getLowerBound()); - case JavaRefPackage.JAVA_EVENT__UPPER_BOUND: - return new Integer(getUpperBound()); - case JavaRefPackage.JAVA_EVENT__MANY: - return isMany() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__REQUIRED: - return isRequired() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__ETYPE: - if (resolve) return getEType(); - return basicGetEType(); - case JavaRefPackage.JAVA_EVENT__CHANGEABLE: - return isChangeable() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__VOLATILE: - return isVolatile() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__TRANSIENT: - return isTransient() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE_LITERAL: - return getDefaultValueLiteral(); - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE: - return getDefaultValue(); - case JavaRefPackage.JAVA_EVENT__UNSETTABLE: - return isUnsettable() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__DERIVED: - return isDerived() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS: - return getEContainingClass(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_EVENT__NAME: - setName((String)newValue); - return; - case JavaRefPackage.JAVA_EVENT__ORDERED: - setOrdered(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__UNIQUE: - setUnique(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__LOWER_BOUND: - setLowerBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.JAVA_EVENT__UPPER_BOUND: - setUpperBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.JAVA_EVENT__ETYPE: - setEType((EClassifier)newValue); - return; - case JavaRefPackage.JAVA_EVENT__CHANGEABLE: - setChangeable(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__VOLATILE: - setVolatile(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__TRANSIENT: - setTransient(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE_LITERAL: - setDefaultValueLiteral((String)newValue); - return; - case JavaRefPackage.JAVA_EVENT__UNSETTABLE: - setUnsettable(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_EVENT__DERIVED: - setDerived(((Boolean)newValue).booleanValue()); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.JAVA_EVENT__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__ORDERED: - setOrdered(ORDERED_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__UNIQUE: - setUnique(UNIQUE_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__LOWER_BOUND: - setLowerBound(LOWER_BOUND_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__UPPER_BOUND: - setUpperBound(UPPER_BOUND_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__ETYPE: - setEType((EClassifier)null); - return; - case JavaRefPackage.JAVA_EVENT__CHANGEABLE: - setChangeable(CHANGEABLE_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__VOLATILE: - setVolatile(VOLATILE_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__TRANSIENT: - setTransient(TRANSIENT_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE_LITERAL: - setDefaultValueLiteral(DEFAULT_VALUE_LITERAL_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__UNSETTABLE: - setUnsettable(UNSETTABLE_EDEFAULT); - return; - case JavaRefPackage.JAVA_EVENT__DERIVED: - setDerived(DERIVED_EDEFAULT); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_EVENT__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.JAVA_EVENT__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.JAVA_EVENT__ORDERED: - return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__UNIQUE: - return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__LOWER_BOUND: - return lowerBound != LOWER_BOUND_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__UPPER_BOUND: - return upperBound != UPPER_BOUND_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__MANY: - return isMany() != MANY_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__REQUIRED: - return isRequired() != REQUIRED_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__ETYPE: - return eType != null; - case JavaRefPackage.JAVA_EVENT__CHANGEABLE: - return ((eFlags & CHANGEABLE_EFLAG) != 0) != CHANGEABLE_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__VOLATILE: - return ((eFlags & VOLATILE_EFLAG) != 0) != VOLATILE_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__TRANSIENT: - return ((eFlags & TRANSIENT_EFLAG) != 0) != TRANSIENT_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE_LITERAL: - return DEFAULT_VALUE_LITERAL_EDEFAULT == null ? defaultValueLiteral != null : !DEFAULT_VALUE_LITERAL_EDEFAULT.equals(defaultValueLiteral); - case JavaRefPackage.JAVA_EVENT__DEFAULT_VALUE: - return DEFAULT_VALUE_EDEFAULT == null ? getDefaultValue() != null : !DEFAULT_VALUE_EDEFAULT.equals(getDefaultValue()); - case JavaRefPackage.JAVA_EVENT__UNSETTABLE: - return ((eFlags & UNSETTABLE_EFLAG) != 0) != UNSETTABLE_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__DERIVED: - return ((eFlags & DERIVED_EFLAG) != 0) != DERIVED_EDEFAULT; - case JavaRefPackage.JAVA_EVENT__ECONTAINING_CLASS: - return getEContainingClass() != null; - } - return eDynamicIsSet(eFeature); - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaFactoryImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaFactoryImpl.java deleted file mode 100644 index dbcfdfd5e..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaFactoryImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: JavaFactoryImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.jem.internal.java.instantiation.IInstantiationHandler; -import org.eclipse.jem.internal.java.instantiation.IInstantiationHandlerFactoryAdapter; - -/** - * The factory to use JavaRef packages. It will use the - * IInstantiationHandler, if there is one, to do the - * factory requests. Else it will let the superclass handle it. - */ -public class JavaFactoryImpl extends EFactoryImpl { - - private IInstantiationHandler instantiationHandler; - private boolean retrievedHandler; - - /** - * Constructor for JavaFactoryImpl. - */ - public JavaFactoryImpl() { - super(); - } - - protected IInstantiationHandler getInstantiationHandler() { - if (!retrievedHandler) { - // Need to retrieve handler lazily because when factory is created it does not yet know what ResourceSet it is in. - // Can't know that until the first time we need a handler. - ResourceSet rset = getEPackage().eResource().getResourceSet(); - if (rset != null) { - retrievedHandler = true; - IInstantiationHandlerFactoryAdapter factory = (IInstantiationHandlerFactoryAdapter) EcoreUtil.getExistingAdapter(rset, IInstantiationHandlerFactoryAdapter.ADAPTER_KEY); - if (factory != null) - instantiationHandler = factory.getInstantiationHandler(this); - } - } - return instantiationHandler; - } - - /** - * @see org.eclipse.emf.ecore.EFactory#create(EClass) - */ - public EObject create(EClass eClass) { - IInstantiationHandler ia = getInstantiationHandler(); - if (ia == null || !ia.handlesClass(eClass)) - return super.create(eClass); - else - return ia.create(eClass); - } - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaPackageImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaPackageImpl.java deleted file mode 100644 index ca4caf503..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaPackageImpl.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: JavaPackageImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.JavaPackage; -import org.eclipse.jem.java.JavaRefPackage; - -import org.eclipse.jem.java.*; - -public class JavaPackageImpl extends EPackageImpl implements JavaPackage, EPackage { - /** - * @generated This field/method will be replaced during code generation. - */ - protected JavaPackageImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getJavaPackage(); - } - - /** - * Get the list of classes that this package contains. - * Since this is a derived relationship, we need to implement - * it here. It will get the metaobjects list. These are the - * java classes this package contains. - * - * If this is the primitives package, then it must return - * an empty list because it doesn't contain any classes. - */ - public EList getJavaClasses() { - return !PRIMITIVE_PACKAGE_NAME.equals(getName()) ? - ECollections.unmodifiableEList(getEClassifiers()) : - ECollections.EMPTY_ELIST; - } -/** - * Return the name for this package. - * We do not want to expose the .javaprim package - * since this is the name of the default package. - */ -public String getName() { - if (isDefault()) - return ""; - else - return super.getName(); -} - public String getPackageName() { - - String internalName = super.getName() ; - return JavaPackage.PRIMITIVE_PACKAGE_NAME.equals(internalName) ? "" : internalName ; -} -protected boolean isDefault() { - return JavaPackage.PRIMITIVE_PACKAGE_NAME.equals(super.getName()); -} - /** - * Since classes are loaded dynamically and not from a schema, a - * class could be asked for through this method, and if not yet reflected, - * it wouldn't be found. We need to make sure that any class asked for - * in this package is found (i.e. poofed up). Otherwise loading an instance - * document that refers to java class through namespaces won't be found. - */ - public EClassifier getEClassifier(String className) { - // Try to get the class from the resource that this package is in. - // This will create it if not found. This works because the - // structure is there is one java package per resource, and - // the id of the class is the class name without the package - // portion, which is what className above is. - Object result = eResource().getEObject(className); - return (result instanceof EClassifier) ? (EClassifier) result : null; - } - - /** - * reflect - reflect a Java package for a given package name. - * If the package does not exist, one will be created through - * the reflection mechanism. - * @deprecated - * @see org.eclipse.jem.java.JavaRefFactory#reflectPackage(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet) - */ - public static JavaPackage reflect(String packageName, ResourceSet set) { - return JavaRefFactory.eINSTANCE.reflectPackage(packageName, set); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - if (eFactoryInstance != null) - msgs = ((InternalEObject)eFactoryInstance).eInverseRemove(this, EcorePackage.EFACTORY__EPACKAGE, EFactory.class, msgs); - return basicSetEFactoryInstance((EFactory)otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - return ((InternalEList)getEClassifiers()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - return ((InternalEList)getESubpackages()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - return basicSetEFactoryInstance(null, msgs); - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - return ((InternalEList)getEClassifiers()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - return ((InternalEList)getESubpackages()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE: - return eBasicSetContainer(null, JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE: - return eContainer.eInverseRemove(this, EcorePackage.EPACKAGE__ESUBPACKAGES, EPackage.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.JAVA_PACKAGE__NAME: - return getName(); - case JavaRefPackage.JAVA_PACKAGE__NS_URI: - return getNsURI(); - case JavaRefPackage.JAVA_PACKAGE__NS_PREFIX: - return getNsPrefix(); - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - return getEFactoryInstance(); - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - return getEClassifiers(); - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - return getESubpackages(); - case JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE: - return getESuperPackage(); - case JavaRefPackage.JAVA_PACKAGE__JAVA_CLASSES: - return getJavaClasses(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__NAME: - setName((String)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__NS_URI: - setNsURI((String)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__NS_PREFIX: - setNsPrefix((String)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - setEFactoryInstance((EFactory)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - getEClassifiers().clear(); - getEClassifiers().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - getESubpackages().clear(); - getESubpackages().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.JAVA_PACKAGE__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_PACKAGE__NS_URI: - setNsURI(NS_URI_EDEFAULT); - return; - case JavaRefPackage.JAVA_PACKAGE__NS_PREFIX: - setNsPrefix(NS_PREFIX_EDEFAULT); - return; - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - setEFactoryInstance((EFactory)null); - return; - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - getEClassifiers().clear(); - return; - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - getESubpackages().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PACKAGE__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.JAVA_PACKAGE__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.JAVA_PACKAGE__NS_URI: - return NS_URI_EDEFAULT == null ? nsURI != null : !NS_URI_EDEFAULT.equals(nsURI); - case JavaRefPackage.JAVA_PACKAGE__NS_PREFIX: - return NS_PREFIX_EDEFAULT == null ? nsPrefix != null : !NS_PREFIX_EDEFAULT.equals(nsPrefix); - case JavaRefPackage.JAVA_PACKAGE__EFACTORY_INSTANCE: - return eFactoryInstance != null; - case JavaRefPackage.JAVA_PACKAGE__ECLASSIFIERS: - return eClassifiers != null && !eClassifiers.isEmpty(); - case JavaRefPackage.JAVA_PACKAGE__ESUBPACKAGES: - return eSubpackages != null && !eSubpackages.isEmpty(); - case JavaRefPackage.JAVA_PACKAGE__ESUPER_PACKAGE: - return getESuperPackage() != null; - case JavaRefPackage.JAVA_PACKAGE__JAVA_CLASSES: - return !getJavaClasses().isEmpty(); - } - return eDynamicIsSet(eFeature); - } - -} //JavaPackageImpl - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaParameterImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaParameterImpl.java deleted file mode 100644 index 7c3aba30d..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaParameterImpl.java +++ /dev/null @@ -1,418 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; - -/* - * $RCSfile: JavaParameterImpl.java,v $ - * $Revision: 1.2 $ $Date: 2005/09/15 20:28:04 $ - */ -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EParameterImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; - - -import org.eclipse.jem.internal.java.adapters.IJavaMethodAdapter; -import org.eclipse.jem.internal.java.adapters.ReadAdaptor; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaParameterKind; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.java.Method; - -/** - * @generated - */ -public class JavaParameterImpl extends EParameterImpl implements JavaParameter{ - - /** - * The default value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final boolean FINAL_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final int FINAL_EFLAG = 1 << 10; - - /** - * The default value of the '{@link #getParameterKind() <em>Parameter Kind</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getParameterKind() - * @generated - * @ordered - */ - protected static final JavaParameterKind PARAMETER_KIND_EDEFAULT = JavaParameterKind.IN_LITERAL; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected JavaParameterKind parameterKind = PARAMETER_KIND_EDEFAULT; - protected JavaParameterImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getJavaParameter(); - } - - public JavaHelpers getJavaType() { - return (JavaHelpers)getEType(); - } - public String getQualifiedName() { - return (eContainer() instanceof Method) ? ((Method)eContainer()).getName() + "." + this.getName() : this.getName(); - } - /** - * Is this parameter type an array type. - */ - public boolean isArray() { - return getJavaType().isArray(); - } - /** - * Is this a return parameter. - */ - public boolean isReturn() { - return JavaParameterKind.RETURN == getParameterKind().getValue(); - } - /** - * @generated This field/method will be replaced during code generation - */ - public boolean isFinal() { - return (eFlags & FINAL_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFinal(boolean newFinal) { - boolean oldFinal = (eFlags & FINAL_EFLAG) != 0; - if (newFinal) eFlags |= FINAL_EFLAG; else eFlags &= ~FINAL_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_PARAMETER__FINAL, oldFinal, newFinal)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaParameterKind getParameterKind() { - return parameterKind; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setParameterKind(JavaParameterKind newParameterKind) { - JavaParameterKind oldParameterKind = parameterKind; - parameterKind = newParameterKind == null ? PARAMETER_KIND_EDEFAULT : newParameterKind; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.JAVA_PARAMETER__PARAMETER_KIND, oldParameterKind, parameterKind)); - } - - /* - * This is not meant to be used outside of the reflection adapters. - */ - public synchronized ReadAdaptor getReadAdapter() { - return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(eContainer(), ReadAdaptor.TYPE_KEY); - } - - private static final int REFLECTED_BASE = 0x1, REFLECTED_PARAM_NAME = 0x2; - - protected int reflectionStatus = REFLECTED_BASE; // At this time base reflection - // is performed at creation. - - protected void reflectParamName() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_PARAM_NAME) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = ((IJavaMethodAdapter) readAdaptor).reflectParamNamesIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - // Normally we wouldn't need to set this because it would be set during the reflectParamNamesIfNecessary, but - // in case there was a problem we mark it still reflected so we don't try again. - if (setReflected) - reflectionStatus |= (REFLECTED_BASE | REFLECTED_PARAM_NAME); // We can be certain base will be done by reflect generated if not already - // done. - } - } - } - - public String getName() { - reflectParamName(); - return super.getName(); - } - - public void setName(String name) { - super.setName(name); - synchronized (this) { - reflectionStatus |= (REFLECTED_PARAM_NAME); - } - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.JAVA_PARAMETER__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.JAVA_PARAMETER__ORDERED: - return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__UNIQUE: - return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__LOWER_BOUND: - return lowerBound != LOWER_BOUND_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__UPPER_BOUND: - return upperBound != UPPER_BOUND_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__MANY: - return isMany() != MANY_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__REQUIRED: - return isRequired() != REQUIRED_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__ETYPE: - return eType != null; - case JavaRefPackage.JAVA_PARAMETER__EOPERATION: - return getEOperation() != null; - case JavaRefPackage.JAVA_PARAMETER__FINAL: - return ((eFlags & FINAL_EFLAG) != 0) != FINAL_EDEFAULT; - case JavaRefPackage.JAVA_PARAMETER__PARAMETER_KIND: - return parameterKind != PARAMETER_KIND_EDEFAULT; - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.JAVA_PARAMETER__NAME: - setName((String)newValue); - return; - case JavaRefPackage.JAVA_PARAMETER__ORDERED: - setOrdered(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_PARAMETER__UNIQUE: - setUnique(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_PARAMETER__LOWER_BOUND: - setLowerBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.JAVA_PARAMETER__UPPER_BOUND: - setUpperBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.JAVA_PARAMETER__ETYPE: - setEType((EClassifier)newValue); - return; - case JavaRefPackage.JAVA_PARAMETER__FINAL: - setFinal(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.JAVA_PARAMETER__PARAMETER_KIND: - setParameterKind((JavaParameterKind)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.JAVA_PARAMETER__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__ORDERED: - setOrdered(ORDERED_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__UNIQUE: - setUnique(UNIQUE_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__LOWER_BOUND: - setLowerBound(LOWER_BOUND_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__UPPER_BOUND: - setUpperBound(UPPER_BOUND_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__ETYPE: - setEType((EClassifier)null); - return; - case JavaRefPackage.JAVA_PARAMETER__FINAL: - setFinal(FINAL_EDEFAULT); - return; - case JavaRefPackage.JAVA_PARAMETER__PARAMETER_KIND: - setParameterKind(PARAMETER_KIND_EDEFAULT); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (final: "); - result.append((eFlags & FINAL_EFLAG) != 0); - result.append(", parameterKind: "); - result.append(parameterKind); - result.append(')'); - return result.toString(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.JAVA_PARAMETER__EOPERATION: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.JAVA_PARAMETER__EOPERATION, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.JAVA_PARAMETER__EOPERATION: - return eBasicSetContainer(null, JavaRefPackage.JAVA_PARAMETER__EOPERATION, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.JAVA_PARAMETER__EOPERATION: - return eContainer.eInverseRemove(this, EcorePackage.EOPERATION__EPARAMETERS, EOperation.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.JAVA_PARAMETER__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.JAVA_PARAMETER__NAME: - return getName(); - case JavaRefPackage.JAVA_PARAMETER__ORDERED: - return isOrdered() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_PARAMETER__UNIQUE: - return isUnique() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_PARAMETER__LOWER_BOUND: - return new Integer(getLowerBound()); - case JavaRefPackage.JAVA_PARAMETER__UPPER_BOUND: - return new Integer(getUpperBound()); - case JavaRefPackage.JAVA_PARAMETER__MANY: - return isMany() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_PARAMETER__REQUIRED: - return isRequired() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_PARAMETER__ETYPE: - if (resolve) return getEType(); - return basicGetEType(); - case JavaRefPackage.JAVA_PARAMETER__EOPERATION: - return getEOperation(); - case JavaRefPackage.JAVA_PARAMETER__FINAL: - return isFinal() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.JAVA_PARAMETER__PARAMETER_KIND: - return getParameterKind(); - } - return eDynamicGet(eFeature, resolve); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefFactoryImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefFactoryImpl.java deleted file mode 100644 index 3d433baac..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefFactoryImpl.java +++ /dev/null @@ -1,599 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -import java.util.List; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.*; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; - -import org.eclipse.jem.internal.java.adapters.ReflectionAdaptor; -import org.eclipse.jem.java.*; -import org.eclipse.jem.java.util.JavaContext; - - - -/** - * @generated - */ -public class JavaRefFactoryImpl extends EFactoryImpl implements JavaRefFactory { - - /** - * Notes about Type URI's. - * <p> - * The format of a type uri is: "java:/package#classname". "package" is either the package name, - * with '.' for package separator (e.g. "java:/a.b#XYZ"). Or for primitive (e.g. "java:/#int") or - * for default package (e.g. "java:/#XYZ"). - * <p> - * The classname has some special changes. First it must use reflection format which means - * that any inner class must use the '$' format, i.e. "A.B" must be "A$B". - * <p> - * Next if there is - * a generic involved then it must be changed in the following way: "A<? extends a.B>" will - * be changed to "A{? extends a!B}". The reason for this is first that '<' and '>' are - * invalid in a fragment (id) of a URI. So we replace them with '{}'. Next because we use - * the fragment "A.field" or "A.method(" to mean a field or method id, we can't have the - * '.' in the generic portion. If it was there we couldn't quickly find the appropriate nesting - * of the generic's '{}' because there could be another generic within the generic, and then - * say to find the '.' after that nested set. - */ - - - /** - * Comment for <code>GENERIC_ID_SEPARATOR</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_ID_SEPARATOR = '!'; - /** - * Comment for <code>GENERIC_SEPARATOR</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_SEPARATOR = '.'; - /** - * Comment for <code>GENERIC_ID_END</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_ID_END = '}'; - /** - * Comment for <code>GENERIC_END</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_END = '>'; - /** - * Comment for <code>GENERIC_ID_START</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_ID_START = '{'; - /** - * Comment for <code>GENERIC_START</code> - * - * @since 1.2.0 - */ - private static final char GENERIC_START = '<'; - - - public JavaRefFactoryImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case JavaRefPackage.JAVA_CLASS: return createJavaClass(); - case JavaRefPackage.INITIALIZER: return createInitializer(); - case JavaRefPackage.JAVA_PARAMETER: return createJavaParameter(); - case JavaRefPackage.METHOD: return createMethod(); - case JavaRefPackage.FIELD: return createField(); - case JavaRefPackage.BLOCK: return createBlock(); - case JavaRefPackage.COMMENT: return createComment(); - case JavaRefPackage.STATEMENT: return createStatement(); - case JavaRefPackage.JAVA_PACKAGE: return createJavaPackage(); - case JavaRefPackage.JAVA_DATA_TYPE: return createJavaDataType(); - case JavaRefPackage.ARRAY_TYPE: return createArrayType(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case JavaRefPackage.TYPE_KIND: { - TypeKind result = TypeKind.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - case JavaRefPackage.JAVA_VISIBILITY_KIND: { - JavaVisibilityKind result = JavaVisibilityKind.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - case JavaRefPackage.JAVA_PARAMETER_KIND: { - JavaParameterKind result = JavaParameterKind.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - case JavaRefPackage.JTYPE_JAVA_HELPERS: - return createJTypeJavaHelpersFromString(eDataType, initialValue); - case JavaRefPackage.JTYPE_LIST: - return createJTypeListFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case JavaRefPackage.TYPE_KIND: - return instanceValue == null ? null : instanceValue.toString(); - case JavaRefPackage.JAVA_VISIBILITY_KIND: - return instanceValue == null ? null : instanceValue.toString(); - case JavaRefPackage.JAVA_PARAMETER_KIND: - return instanceValue == null ? null : instanceValue.toString(); - case JavaRefPackage.JTYPE_JAVA_HELPERS: - return convertJTypeJavaHelpersToString(eDataType, instanceValue); - case JavaRefPackage.JTYPE_LIST: - return convertJTypeListToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - public ArrayType createArrayType(JavaHelpers componentType) { - ArrayType at = createArrayType(); - - String computedName = componentType.getQualifiedName() + "[]"; - at.setName(computedName); - return at; - } - public ArrayType createArrayType(JavaHelpers finalComponentType, int dimensions) { - ArrayType at = createArrayType(); - - String computedName = finalComponentType.getQualifiedName(); - for (int i = 0; i < dimensions; i++){ - computedName = computedName + "[]"; - } - at.setName(computedName); - return at; - } - - /** - * Get the java context - * @return - * - * @deprecated Use the API {@link JavaContext#createJavaContext()} instead. - * @since 1.2.0 - */ - public static ResourceSet createJavaContext() { - return JavaContext.createJavaContext(); - } - /** - * Return the Class for the Java refection adapter factory. - * @deprecated Use the API {@link JavaContext#getReflectionAdapterFactoryClass()} instead. - */ - public static Class getReflectionAdapterFactoryClass() { - return JavaContext.getReflectionAdapterFactoryClass(); - } - - /** - * Set the Class for the Java refection adapter factory. - * - * @deprecated Use the API {@link JavaContext#setReflectionAdapterFactoryClass(Class)} instead. - */ - public static void setReflectionAdapterFactoryClass(Class javaReflectionFactoryClass) { - JavaContext.setReflectionAdapterFactoryClass(javaReflectionFactoryClass); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Method createMethod() { - MethodImpl method = new MethodImpl(); - return method; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaClass createJavaClass() { - JavaClassImpl javaClass = new JavaClassImpl(); - return javaClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Field createField() { - FieldImpl field = new FieldImpl(); - return field; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Block createBlock() { - BlockImpl block = new BlockImpl(); - return block; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Comment createComment() { - CommentImpl comment = new CommentImpl(); - return comment; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Statement createStatement() { - StatementImpl statement = new StatementImpl(); - return statement; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public Initializer createInitializer() { - InitializerImpl initializer = new InitializerImpl(); - return initializer; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaParameter createJavaParameter() { - JavaParameterImpl javaParameter = new JavaParameterImpl(); - return javaParameter; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public ArrayType createArrayType() { - ArrayTypeImpl arrayType = new ArrayTypeImpl(); - return arrayType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaHelpers createJTypeJavaHelpersFromString(EDataType eDataType, String initialValue) { - return (JavaHelpers)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertJTypeJavaHelpersToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public List createJTypeListFromString(EDataType eDataType, String initialValue) { - return (List)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertJTypeListToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaDataType createJavaDataType() { - JavaDataTypeImpl javaDataType = new JavaDataTypeImpl(); - return javaDataType; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaPackage createJavaPackage() { - JavaPackageImpl javaPackage = new JavaPackageImpl(); - return javaPackage; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaRefPackage getJavaRefPackage() { - return (JavaRefPackage)getEPackage(); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public static JavaRefPackage getPackage() { - return JavaRefPackage.eINSTANCE; - } - - public static JavaRefFactory getActiveFactory() { - return JavaRefFactory.eINSTANCE; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.java.JavaRefFactory#createClassRef(java.lang.String) - */ - public JavaClass createClassRef(String targetName) { - JavaClass ref = createJavaClass(); - ((InternalEObject) ref).eSetProxyURI(createTypeURI(targetName)); - return ref; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.EObject) - */ - public JavaHelpers reflectType(String aQualifiedName, EObject relatedObject) { - Resource r = relatedObject.eResource(); - if (r != null) { - ResourceSet rs = r.getResourceSet(); - if (rs != null) { - return reflectType(aQualifiedName, rs); - } - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet) - */ - public JavaHelpers reflectType(String aQualifiedName, ResourceSet set) { - if (aQualifiedName != null) { - int index = aQualifiedName.lastIndexOf("."); - if (index > 0) - return reflectType(aQualifiedName.substring(0, index), aQualifiedName.substring(index + 1, aQualifiedName.length()), set); - else - return reflectType("", aQualifiedName, set); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#reflectType(java.lang.String, java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet) - */ - public JavaHelpers reflectType(String aPackageName, String aTypeName, ResourceSet set) { - if (aTypeName != null && aPackageName != null) { - org.eclipse.jem.internal.java.init.JavaInit.init(); - return (JavaHelpers) set.getEObject(createTypeURI(aPackageName, aTypeName), true); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#reflectPackage(java.lang.String, org.eclipse.emf.ecore.resource.ResourceSet) - */ - public JavaPackage reflectPackage(String packageName, ResourceSet set) { - if (packageName != null) { - org.eclipse.jem.internal.java.init.JavaInit.init(); - return (JavaPackage) set.getEObject(createPackageURI(packageName), true); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#createTypeURI(java.lang.String) - */ - public URI createTypeURI(String aQualifiedName) { - // for need to just tolerate generics (i.e. "<...>". Fully support later. - //In this case tolerate means ignore the parameter types. - int genNdx = aQualifiedName.indexOf(GENERIC_START); - int pkgNdx = genNdx == -1 ? aQualifiedName.lastIndexOf('.') : aQualifiedName.lastIndexOf('.', genNdx); - if (pkgNdx > -1) - return createTypeURI(aQualifiedName.substring(0, pkgNdx), genNdx == -1 ? aQualifiedName.substring(pkgNdx+1) : aQualifiedName.substring(pkgNdx+1, genNdx)); - else - return createTypeURI(null, aQualifiedName); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#createTypeURI(java.lang.String, java.lang.String) - */ - public URI createTypeURI(String packageName, String typeName) { - String[] pkgname = null; - if (packageName != null && packageName.length() > 0) - pkgname = new String[] {packageName}; - return URI.createHierarchicalURI(JAVA_PROTOCOL_URI_SCHEME, null, null, pkgname, null, createTypeName(typeName)); - } - - /** - * Create a URI'd type name from a regular typename. - * <p> - * This should only be used by friends of the Impl package. - * @param typeName type name, no package allowed, and must be in form for reflection (i.e. '$' not '.' to separate outer and inner classes). - * @return - * - * @since 1.2.0 - */ - public String createTypeName(String typeName) { - - int genStart = typeName.indexOf(GENERIC_START); - if (genStart > -1) { - char[] chName = new char[typeName.length()]; - typeName.getChars(0, chName.length, chName, 0); - for (int i = 0; i < chName.length; i++) { - switch (chName[i]) { - case GENERIC_START: - chName[i] = GENERIC_ID_START; - break; - case GENERIC_END: - chName[i] = GENERIC_ID_END; - break; - case GENERIC_SEPARATOR: - chName[i] = GENERIC_ID_SEPARATOR; - break; - default: - break; - } - } - typeName = new String(chName); - } - return typeName; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#getTypeName(org.eclipse.emf.common.util.URI) - */ - public String getTypeName(URI typeURI) { - if (isTypeURI(typeURI)) { - return primGetTypeName(typeURI.fragment()); - } else - throw new IllegalArgumentException(typeURI.toString()); - } - - /** - * Get type name from URI'd typename. - * <p> - * This should only be used by friends of the Impl package. - * @param type uri fragment value for type name. - * @return - * - * @since 1.2.0 - */ - public String primGetTypeName(String typeName) { - int genStart = typeName.indexOf(GENERIC_ID_START); - if (genStart > -1) { - char[] chName = new char[typeName.length()]; - typeName.getChars(0, chName.length, chName, 0); - for (int i = 0; i < chName.length; i++) { - switch (chName[i]) { - case GENERIC_ID_START: - chName[i] = GENERIC_START; - break; - case GENERIC_ID_END: - chName[i] = GENERIC_END; - break; - case GENERIC_ID_SEPARATOR: - chName[i] = GENERIC_SEPARATOR; - break; - default: - break; - } - } - typeName = new String(chName); - } - return typeName; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#getPackageName(org.eclipse.emf.common.util.URI) - */ - public String getPackageName(URI javaURI) { - if (isTypeURI(javaURI) || isPackageURI(javaURI)) { - if (javaURI.segmentCount() == 1) { - return javaURI.segment(0); - } else if (javaURI.segmentCount() == 0) - return ""; //$NON-NLS-1$ - else - throw new IllegalArgumentException(javaURI.toString()); - } else - throw new IllegalArgumentException(javaURI.toString()); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#getFullTypeName(org.eclipse.emf.common.util.URI) - */ - public String getFullTypeName(URI typeURI) { - String pkgName = getPackageName(typeURI); - if (!isTypeURI(typeURI)) - throw new IllegalArgumentException(typeURI.toString()); - - if (pkgName.length() > 0) - return pkgName+'.'+getTypeName(typeURI); - else - return typeURI.fragment(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#createPackageURI(java.lang.String) - */ - public URI createPackageURI(String packageName) { - String[] pkgname = null; - if (packageName != null && packageName.length() > 0) - pkgname = new String[] {packageName}; - return URI.createHierarchicalURI(JAVA_PROTOCOL_URI_SCHEME, null, null, pkgname, null, JavaPackage.PACKAGE_ID); - } - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#isJavaURI(org.eclipse.emf.common.util.URI) - */ - public boolean isJavaURI(URI uri) { - return JAVA_PROTOCOL_URI_SCHEME.equals(uri.scheme()); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#isTypeURI(org.eclipse.emf.common.util.URI) - */ - public boolean isTypeURI(URI uri) { - if (isJavaURI(uri)) { - String frag = uri.fragment(); - if (frag != null && !JavaPackage.PACKAGE_ID.equals(frag)) { - int delimNdx = frag.indexOf(ReflectionAdaptor.C_CLASS_MEMBER_DELIMITER); - if (delimNdx != -1) - return false; - delimNdx = frag.indexOf('/'); // From beaninfo for property. - if (delimNdx != -1) - return false; - else - return true; - } else - return false; - } else - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.java.JavaRefFactory#isPackageURI(org.eclipse.emf.common.util.URI) - */ - public boolean isPackageURI(URI uri) { - return isJavaURI(uri) && JavaPackage.PACKAGE_ID.equals(uri.fragment()); - } - -} - - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefPackageImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefPackageImpl.java deleted file mode 100644 index 6ab5bd316..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaRefPackageImpl.java +++ /dev/null @@ -1,1029 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: JavaRefPackageImpl.java,v $ - * $Revision: 1.3 $ $Date: 2006/05/17 20:13:07 $ - */ -import java.util.List; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.ecore.impl.EcorePackageImpl; - - -import org.eclipse.jem.java.ArrayType; -import org.eclipse.jem.java.Block; -import org.eclipse.jem.java.Comment; -import org.eclipse.jem.java.Field; -import org.eclipse.jem.java.Initializer; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaDataType; -import org.eclipse.jem.java.JavaEvent; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaPackage; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaParameterKind; -import org.eclipse.jem.java.JavaRefFactory; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.java.JavaVisibilityKind; -import org.eclipse.jem.java.Method; -import org.eclipse.jem.java.Statement; -import org.eclipse.jem.java.TypeKind; - - -/** - * @lastgen class JavaRefPackageImpl extends EPackageImpl implements JavaRefPackage, EPackage {} - */ -public class JavaRefPackageImpl extends EPackageImpl implements JavaRefPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaClassEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass initializerEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaParameterEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass methodEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass fieldEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass blockEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass commentEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass statementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaPackageEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaDataTypeEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass arrayTypeEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaEventEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum typeKindEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum javaVisibilityKindEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum javaParameterKindEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType jTypeJavaHelpersEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType jTypeListEDataType = null; - - /** - * @generated This field/method will be replaced during code generation. - */ - private JavaRefPackageImpl() { - super(eNS_URI, JavaRefFactory.eINSTANCE); - } - - /** - * Do not use. This is here only for the use of the older deprecated org.eclipse.jem.java.impl.JavaRefPackageImpl. - * @param b - * - * - * @since 1.2.0 - */ - protected JavaRefPackageImpl(boolean b) { - this(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * This is here only for older pre-EMF 2.2 generated code that accesses the package directly instead of through the interface. New - * code should not use this directly. - * @return - * @since 1.2.0 - */ - public static JavaRefPackage init() { - if (isInited) return (JavaRefPackage)EPackage.Registry.INSTANCE.getEPackage(JavaRefPackage.eNS_URI); - - // Note: Need to be careful here. If EMF ever changes how it generates the init method and assigns the - // package in a different way then this will need to change too. - if (!(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof org.eclipse.jem.java.impl.JavaRefPackageImpl)) - new org.eclipse.jem.java.impl.JavaRefPackageImpl(); - return initGen(); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public static JavaRefPackage initGen() { - if (isInited) return (JavaRefPackage)EPackage.Registry.INSTANCE.getEPackage(JavaRefPackage.eNS_URI); - - // Obtain or create and register package - JavaRefPackageImpl theJavaRefPackage = (JavaRefPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JavaRefPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JavaRefPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackageImpl.init(); - - // Create package meta-data objects - theJavaRefPackage.createPackageContents(); - - // Initialize created meta-data - theJavaRefPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theJavaRefPackage.freeze(); - - return theJavaRefPackage; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getJavaClass() { - return javaClassEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getJavaClass_Kind() { - return (EAttribute)javaClassEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJavaClass_Public() { - return (EAttribute)javaClassEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJavaClass_Final() { - return (EAttribute)javaClassEClass.getEStructuralFeatures().get(2); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_ImplementsInterfaces() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(3); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_ClassImport() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(4); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_PackageImports() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(5); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_Fields() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(6); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_Methods() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(7); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_Initializers() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(8); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_DeclaringClass() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(10); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_DeclaredClasses() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(9); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_JavaPackage() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(11); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_Events() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(12); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaClass_AllEvents() { - return (EReference)javaClassEClass.getEStructuralFeatures().get(13); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getField() { - return fieldEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getField_Final() { - return (EAttribute)fieldEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getField_Static() { - return (EAttribute)fieldEClass.getEStructuralFeatures().get(1); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getField_JavaVisibility() { - return (EAttribute)fieldEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getField_Transient() { - return (EAttribute)fieldEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getField_Volatile() { - return (EAttribute)fieldEClass.getEStructuralFeatures().get(4); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getField_JavaClass() { - return (EReference)fieldEClass.getEStructuralFeatures().get(5); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getField_Initializer() { - return (EReference)fieldEClass.getEStructuralFeatures().get(6); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getMethod() { - return methodEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Abstract() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Native() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Synchronized() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Final() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Constructor() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMethod_Static() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(5); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getMethod_JavaVisibility() { - return (EAttribute)methodEClass.getEStructuralFeatures().get(6); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getMethod_Parameters() { - return (EReference)methodEClass.getEStructuralFeatures().get(7); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getMethod_JavaExceptions() { - return (EReference)methodEClass.getEStructuralFeatures().get(8); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getMethod_JavaClass() { - return (EReference)methodEClass.getEStructuralFeatures().get(9); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getMethod_Source() { - return (EReference)methodEClass.getEStructuralFeatures().get(10); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getJavaParameter() { - return javaParameterEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJavaParameter_Final() { - return (EAttribute)javaParameterEClass.getEStructuralFeatures().get(0); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getJavaParameter_ParameterKind() { - return (EAttribute)javaParameterEClass.getEStructuralFeatures().get(1); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getArrayType() { - return arrayTypeEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getArrayType_ArrayDimensions() { - return (EAttribute)arrayTypeEClass.getEStructuralFeatures().get(0); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getArrayType_ComponentType() { - return (EReference)arrayTypeEClass.getEStructuralFeatures().get(1); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getJavaDataType() { - return javaDataTypeEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getJavaEvent() { - return javaEventEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getJavaPackage() { - return javaPackageEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getJavaPackage_JavaClasses() { - return (EReference)javaPackageEClass.getEStructuralFeatures().get(0); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getBlock() { - return blockEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getBlock_Source() { - return (EAttribute)blockEClass.getEStructuralFeatures().get(0); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getBlock_Name() { - return (EAttribute)blockEClass.getEStructuralFeatures().get(1); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getBlock_Contents() { - return (EReference)blockEClass.getEStructuralFeatures().get(2); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getComment() { - return commentEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getStatement() { - return statementEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EClass getInitializer() { - return initializerEClass; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EAttribute getInitializer_IsStatic() { - return (EAttribute)initializerEClass.getEStructuralFeatures().get(0); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getInitializer_JavaClass() { - return (EReference)initializerEClass.getEStructuralFeatures().get(1); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EReference getInitializer_Source() { - return (EReference)initializerEClass.getEStructuralFeatures().get(2); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EEnum getJavaVisibilityKind() { - return javaVisibilityKindEEnum; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EEnum getJavaParameterKind() { - return javaParameterKindEEnum; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EEnum getTypeKind() { - return typeKindEEnum; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EDataType getJTypeList() { - return jTypeListEDataType; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public EDataType getJTypeJavaHelpers() { - return jTypeJavaHelpersEDataType; - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public JavaRefFactory getJavaRefFactory() { - return (JavaRefFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - javaClassEClass = createEClass(JAVA_CLASS); - createEAttribute(javaClassEClass, JAVA_CLASS__KIND); - createEAttribute(javaClassEClass, JAVA_CLASS__PUBLIC); - createEAttribute(javaClassEClass, JAVA_CLASS__FINAL); - createEReference(javaClassEClass, JAVA_CLASS__IMPLEMENTS_INTERFACES); - createEReference(javaClassEClass, JAVA_CLASS__CLASS_IMPORT); - createEReference(javaClassEClass, JAVA_CLASS__PACKAGE_IMPORTS); - createEReference(javaClassEClass, JAVA_CLASS__FIELDS); - createEReference(javaClassEClass, JAVA_CLASS__METHODS); - createEReference(javaClassEClass, JAVA_CLASS__INITIALIZERS); - createEReference(javaClassEClass, JAVA_CLASS__DECLARED_CLASSES); - createEReference(javaClassEClass, JAVA_CLASS__DECLARING_CLASS); - createEReference(javaClassEClass, JAVA_CLASS__JAVA_PACKAGE); - createEReference(javaClassEClass, JAVA_CLASS__EVENTS); - createEReference(javaClassEClass, JAVA_CLASS__ALL_EVENTS); - - initializerEClass = createEClass(INITIALIZER); - createEAttribute(initializerEClass, INITIALIZER__IS_STATIC); - createEReference(initializerEClass, INITIALIZER__JAVA_CLASS); - createEReference(initializerEClass, INITIALIZER__SOURCE); - - javaParameterEClass = createEClass(JAVA_PARAMETER); - createEAttribute(javaParameterEClass, JAVA_PARAMETER__FINAL); - createEAttribute(javaParameterEClass, JAVA_PARAMETER__PARAMETER_KIND); - - methodEClass = createEClass(METHOD); - createEAttribute(methodEClass, METHOD__ABSTRACT); - createEAttribute(methodEClass, METHOD__NATIVE); - createEAttribute(methodEClass, METHOD__SYNCHRONIZED); - createEAttribute(methodEClass, METHOD__FINAL); - createEAttribute(methodEClass, METHOD__CONSTRUCTOR); - createEAttribute(methodEClass, METHOD__STATIC); - createEAttribute(methodEClass, METHOD__JAVA_VISIBILITY); - createEReference(methodEClass, METHOD__PARAMETERS); - createEReference(methodEClass, METHOD__JAVA_EXCEPTIONS); - createEReference(methodEClass, METHOD__JAVA_CLASS); - createEReference(methodEClass, METHOD__SOURCE); - - fieldEClass = createEClass(FIELD); - createEAttribute(fieldEClass, FIELD__FINAL); - createEAttribute(fieldEClass, FIELD__STATIC); - createEAttribute(fieldEClass, FIELD__JAVA_VISIBILITY); - createEAttribute(fieldEClass, FIELD__TRANSIENT); - createEAttribute(fieldEClass, FIELD__VOLATILE); - createEReference(fieldEClass, FIELD__JAVA_CLASS); - createEReference(fieldEClass, FIELD__INITIALIZER); - - blockEClass = createEClass(BLOCK); - createEAttribute(blockEClass, BLOCK__SOURCE); - createEAttribute(blockEClass, BLOCK__NAME); - createEReference(blockEClass, BLOCK__CONTENTS); - - commentEClass = createEClass(COMMENT); - - statementEClass = createEClass(STATEMENT); - - javaPackageEClass = createEClass(JAVA_PACKAGE); - createEReference(javaPackageEClass, JAVA_PACKAGE__JAVA_CLASSES); - - javaDataTypeEClass = createEClass(JAVA_DATA_TYPE); - - arrayTypeEClass = createEClass(ARRAY_TYPE); - createEAttribute(arrayTypeEClass, ARRAY_TYPE__ARRAY_DIMENSIONS); - createEReference(arrayTypeEClass, ARRAY_TYPE__COMPONENT_TYPE); - - javaEventEClass = createEClass(JAVA_EVENT); - - // Create enums - typeKindEEnum = createEEnum(TYPE_KIND); - javaVisibilityKindEEnum = createEEnum(JAVA_VISIBILITY_KIND); - javaParameterKindEEnum = createEEnum(JAVA_PARAMETER_KIND); - - // Create data types - jTypeJavaHelpersEDataType = createEDataType(JTYPE_JAVA_HELPERS); - jTypeListEDataType = createEDataType(JTYPE_LIST); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - EcorePackageImpl theEcorePackage = (EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); - - // Add supertypes to classes - javaClassEClass.getESuperTypes().add(theEcorePackage.getEClass()); - javaParameterEClass.getESuperTypes().add(theEcorePackage.getEParameter()); - methodEClass.getESuperTypes().add(theEcorePackage.getEOperation()); - fieldEClass.getESuperTypes().add(theEcorePackage.getETypedElement()); - commentEClass.getESuperTypes().add(this.getBlock()); - statementEClass.getESuperTypes().add(this.getBlock()); - javaPackageEClass.getESuperTypes().add(theEcorePackage.getEPackage()); - javaDataTypeEClass.getESuperTypes().add(theEcorePackage.getEClass()); - arrayTypeEClass.getESuperTypes().add(this.getJavaClass()); - javaEventEClass.getESuperTypes().add(theEcorePackage.getEStructuralFeature()); - - // Initialize classes and features; add operations and parameters - initEClass(javaClassEClass, JavaClass.class, "JavaClass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJavaClass_Kind(), this.getTypeKind(), "kind", null, 0, 1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJavaClass_Public(), ecorePackage.getEBoolean(), "public", null, 0, 1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJavaClass_Final(), ecorePackage.getEBoolean(), "final", null, 0, 1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_ImplementsInterfaces(), this.getJavaClass(), null, "implementsInterfaces", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_ClassImport(), this.getJavaClass(), null, "classImport", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_PackageImports(), this.getJavaPackage(), null, "packageImports", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_Fields(), this.getField(), this.getField_JavaClass(), "fields", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_Methods(), this.getMethod(), this.getMethod_JavaClass(), "methods", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_Initializers(), this.getInitializer(), this.getInitializer_JavaClass(), "initializers", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_DeclaredClasses(), this.getJavaClass(), this.getJavaClass_DeclaringClass(), "declaredClasses", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_DeclaringClass(), this.getJavaClass(), this.getJavaClass_DeclaredClasses(), "declaringClass", null, 0, 1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_JavaPackage(), this.getJavaPackage(), this.getJavaPackage_JavaClasses(), "javaPackage", null, 0, 1, JavaClass.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_Events(), this.getJavaEvent(), null, "events", null, 0, -1, JavaClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getJavaClass_AllEvents(), this.getJavaEvent(), null, "allEvents", null, 0, -1, JavaClass.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(javaClassEClass, ecorePackage.getEBoolean(), "isNested"); - - EOperation op = addEOperation(javaClassEClass, this.getField(), "getField"); - addEParameter(op, ecorePackage.getEString(), "fieldName"); - - op = addEOperation(javaClassEClass, this.getField(), "getFieldExtended"); - addEParameter(op, ecorePackage.getEString(), "fieldName"); - - op = addEOperation(javaClassEClass, this.getField(), "getFieldNamed"); - addEParameter(op, ecorePackage.getEString(), "fieldName"); - - addEOperation(javaClassEClass, this.getJTypeList(), "getFieldsExtended"); - - op = addEOperation(javaClassEClass, this.getMethod(), "getMethod"); - addEParameter(op, ecorePackage.getEString(), "methodName"); - addEParameter(op, this.getJTypeList(), "parameterTypes"); - - addEOperation(javaClassEClass, this.getJTypeList(), "getMethodElementSignatures"); - - op = addEOperation(javaClassEClass, this.getMethod(), "getMethodExtended"); - addEParameter(op, ecorePackage.getEString(), "methodName"); - addEParameter(op, this.getJTypeList(), "parameterTypes"); - - addEOperation(javaClassEClass, this.getJTypeList(), "getMethodsExtended"); - - op = addEOperation(javaClassEClass, this.getJTypeList(), "getOnlySpecificMethods"); - addEParameter(op, ecorePackage.getEString(), "aMethodNamePrefix"); - addEParameter(op, this.getJTypeList(), "excludedNames"); - - op = addEOperation(javaClassEClass, this.getMethod(), "getPublicMethod"); - addEParameter(op, ecorePackage.getEString(), "methodName"); - addEParameter(op, this.getJTypeList(), "parameterTypes"); - - addEOperation(javaClassEClass, this.getJTypeList(), "getPublicMethods"); - - addEOperation(javaClassEClass, this.getJTypeList(), "getPublicMethodsExtended"); - - op = addEOperation(javaClassEClass, this.getJTypeList(), "getPublicMethodsNamed"); - addEParameter(op, ecorePackage.getEString(), "name"); - - addEOperation(javaClassEClass, this.getJavaClass(), "getSupertype"); - - op = addEOperation(javaClassEClass, ecorePackage.getEBoolean(), "implementsInterface"); - addEParameter(op, this.getJavaClass(), "interfaceType"); - - addEOperation(javaClassEClass, ecorePackage.getEString(), "infoString"); - - op = addEOperation(javaClassEClass, ecorePackage.getEBoolean(), "inheritsFrom"); - addEParameter(op, this.getJavaClass(), "javaClass"); - - addEOperation(javaClassEClass, ecorePackage.getEBoolean(), "isExistingType"); - - addEOperation(javaClassEClass, ecorePackage.getEBoolean(), "isInterface"); - - op = addEOperation(javaClassEClass, null, "setSupertype"); - addEParameter(op, this.getJavaClass(), "javaclass"); - - initEClass(initializerEClass, Initializer.class, "Initializer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getInitializer_IsStatic(), ecorePackage.getEBooleanObject(), "isStatic", null, 0, 1, Initializer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getInitializer_JavaClass(), this.getJavaClass(), this.getJavaClass_Initializers(), "javaClass", null, 0, 1, Initializer.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getInitializer_Source(), this.getBlock(), null, "source", null, 0, 1, Initializer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(javaParameterEClass, JavaParameter.class, "JavaParameter", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getJavaParameter_Final(), ecorePackage.getEBoolean(), "final", null, 0, 1, JavaParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getJavaParameter_ParameterKind(), this.getJavaParameterKind(), "parameterKind", null, 0, 1, JavaParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(javaParameterEClass, ecorePackage.getEBoolean(), "isArray"); - - addEOperation(javaParameterEClass, ecorePackage.getEBoolean(), "isReturn"); - - addEOperation(javaParameterEClass, this.getJTypeJavaHelpers(), "getJavaType"); - - addEOperation(javaParameterEClass, ecorePackage.getEString(), "getQualifiedName"); - - initEClass(methodEClass, Method.class, "Method", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getMethod_Abstract(), ecorePackage.getEBoolean(), "abstract", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_Native(), ecorePackage.getEBoolean(), "native", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_Synchronized(), ecorePackage.getEBoolean(), "synchronized", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_Final(), ecorePackage.getEBoolean(), "final", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_Constructor(), ecorePackage.getEBoolean(), "constructor", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_Static(), ecorePackage.getEBoolean(), "static", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMethod_JavaVisibility(), this.getJavaVisibilityKind(), "javaVisibility", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getMethod_Parameters(), this.getJavaParameter(), null, "parameters", null, 0, -1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getMethod_JavaExceptions(), this.getJavaClass(), null, "javaExceptions", null, 0, -1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getMethod_JavaClass(), this.getJavaClass(), this.getJavaClass_Methods(), "javaClass", null, 0, 1, Method.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getMethod_Source(), this.getBlock(), null, "source", null, 0, 1, Method.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(methodEClass, this.getJavaClass(), "getContainingJavaClass"); - - addEOperation(methodEClass, ecorePackage.getEString(), "getMethodElementSignature"); - - op = addEOperation(methodEClass, this.getJavaParameter(), "getParameter"); - addEParameter(op, ecorePackage.getEString(), "parameterName"); - - addEOperation(methodEClass, this.getJTypeJavaHelpers(), "getReturnType"); - - op = addEOperation(methodEClass, null, "setReturnType"); - addEParameter(op, this.getJTypeJavaHelpers(), "type"); - - addEOperation(methodEClass, ecorePackage.getEString(), "getSignature"); - - addEOperation(methodEClass, ecorePackage.getEBoolean(), "isGenerated"); - - op = addEOperation(methodEClass, null, "setIsGenerated"); - addEParameter(op, ecorePackage.getEBoolean(), "generated"); - - addEOperation(methodEClass, ecorePackage.getEBoolean(), "isVoid"); - - initEClass(fieldEClass, Field.class, "Field", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getField_Final(), ecorePackage.getEBoolean(), "final", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getField_Static(), ecorePackage.getEBoolean(), "static", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getField_JavaVisibility(), this.getJavaVisibilityKind(), "javaVisibility", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getField_Transient(), ecorePackage.getEBoolean(), "transient", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getField_Volatile(), ecorePackage.getEBoolean(), "volatile", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getField_JavaClass(), this.getJavaClass(), this.getJavaClass_Fields(), "javaClass", null, 0, 1, Field.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getField_Initializer(), this.getBlock(), null, "initializer", null, 0, 1, Field.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(fieldEClass, this.getJavaClass(), "getContainingJavaClass"); - - addEOperation(fieldEClass, ecorePackage.getEBoolean(), "isArray"); - - initEClass(blockEClass, Block.class, "Block", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getBlock_Source(), ecorePackage.getEString(), "source", null, 0, 1, Block.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getBlock_Name(), ecorePackage.getEString(), "name", null, 0, 1, Block.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getBlock_Contents(), this.getBlock(), null, "contents", null, 0, -1, Block.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(commentEClass, Comment.class, "Comment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - initEClass(statementEClass, Statement.class, "Statement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - initEClass(javaPackageEClass, JavaPackage.class, "JavaPackage", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getJavaPackage_JavaClasses(), this.getJavaClass(), this.getJavaClass_JavaPackage(), "javaClasses", null, 0, -1, JavaPackage.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(javaDataTypeEClass, JavaDataType.class, "JavaDataType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - addEOperation(javaDataTypeEClass, ecorePackage.getEString(), "getDefaultValueString"); - - initEClass(arrayTypeEClass, ArrayType.class, "ArrayType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getArrayType_ArrayDimensions(), ecorePackage.getEInt(), "arrayDimensions", null, 0, 1, ArrayType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getArrayType_ComponentType(), theEcorePackage.getEClassifier(), null, "componentType", null, 1, 1, ArrayType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - addEOperation(arrayTypeEClass, this.getJTypeJavaHelpers(), "getFinalComponentType"); - - addEOperation(arrayTypeEClass, this.getJTypeJavaHelpers(), "getComponentTypeAsHelper"); - - addEOperation(arrayTypeEClass, ecorePackage.getEBoolean(), "isPrimitiveArray"); - - op = addEOperation(arrayTypeEClass, null, "setComponentType"); - addEParameter(op, this.getJTypeJavaHelpers(), "helperComponentType"); - - initEClass(javaEventEClass, JavaEvent.class, "JavaEvent", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - // Initialize enums and add enum literals - initEEnum(typeKindEEnum, TypeKind.class, "TypeKind"); - addEEnumLiteral(typeKindEEnum, TypeKind.UNDEFINED_LITERAL); - addEEnumLiteral(typeKindEEnum, TypeKind.CLASS_LITERAL); - addEEnumLiteral(typeKindEEnum, TypeKind.INTERFACE_LITERAL); - addEEnumLiteral(typeKindEEnum, TypeKind.EXCEPTION_LITERAL); - - initEEnum(javaVisibilityKindEEnum, JavaVisibilityKind.class, "JavaVisibilityKind"); - addEEnumLiteral(javaVisibilityKindEEnum, JavaVisibilityKind.PUBLIC_LITERAL); - addEEnumLiteral(javaVisibilityKindEEnum, JavaVisibilityKind.PRIVATE_LITERAL); - addEEnumLiteral(javaVisibilityKindEEnum, JavaVisibilityKind.PROTECTED_LITERAL); - addEEnumLiteral(javaVisibilityKindEEnum, JavaVisibilityKind.PACKAGE_LITERAL); - - initEEnum(javaParameterKindEEnum, JavaParameterKind.class, "JavaParameterKind"); - addEEnumLiteral(javaParameterKindEEnum, JavaParameterKind.IN_LITERAL); - addEEnumLiteral(javaParameterKindEEnum, JavaParameterKind.OUT_LITERAL); - addEEnumLiteral(javaParameterKindEEnum, JavaParameterKind.INOUT_LITERAL); - addEEnumLiteral(javaParameterKindEEnum, JavaParameterKind.RETURN_LITERAL); - - // Initialize data types - initEDataType(jTypeJavaHelpersEDataType, JavaHelpers.class, "JTypeJavaHelpers", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - initEDataType(jTypeListEDataType, List.class, "JTypeList", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - - // Create resource - createResource(eNS_URI); - } - -} - - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java deleted file mode 100644 index 4486cbbc5..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java +++ /dev/null @@ -1,1133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; - -/* - * $RCSfile: MethodImpl.java,v $ - * $Revision: 1.2 $ $Date: 2005/09/15 20:28:03 $ - */ - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EOperationImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.Block; -import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaHelpers; -import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.java.JavaVisibilityKind; -import org.eclipse.jem.java.Method; - - -import org.eclipse.jem.internal.java.adapters.IJavaMethodAdapter; -import org.eclipse.jem.internal.java.adapters.ReadAdaptor; - -/** - * @generated - */ -public class MethodImpl extends EOperationImpl implements Method { - - protected String signature; - - /** - * The default value of the '{@link #isAbstract() <em>Abstract</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isAbstract() - * @generated - * @ordered - */ - protected static final boolean ABSTRACT_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isAbstract() <em>Abstract</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isAbstract() - * @generated - * @ordered - */ - protected static final int ABSTRACT_EFLAG = 1 << 10; - - /** - * The default value of the '{@link #isNative() <em>Native</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNative() - * @generated - * @ordered - */ - protected static final boolean NATIVE_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isNative() <em>Native</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isNative() - * @generated - * @ordered - */ - protected static final int NATIVE_EFLAG = 1 << 11; - - /** - * The default value of the '{@link #isSynchronized() <em>Synchronized</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSynchronized() - * @generated - * @ordered - */ - protected static final boolean SYNCHRONIZED_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isSynchronized() <em>Synchronized</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isSynchronized() - * @generated - * @ordered - */ - protected static final int SYNCHRONIZED_EFLAG = 1 << 12; - - /** - * The default value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final boolean FINAL_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isFinal() <em>Final</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFinal() - * @generated - * @ordered - */ - protected static final int FINAL_EFLAG = 1 << 13; - - /** - * The default value of the '{@link #isConstructor() <em>Constructor</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isConstructor() - * @generated - * @ordered - */ - protected static final boolean CONSTRUCTOR_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isConstructor() <em>Constructor</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isConstructor() - * @generated - * @ordered - */ - protected static final int CONSTRUCTOR_EFLAG = 1 << 14; - - /** - * The default value of the '{@link #isStatic() <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStatic() - * @generated - * @ordered - */ - protected static final boolean STATIC_EDEFAULT = false; - - /** - * The flag representing the value of the '{@link #isStatic() <em>Static</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isStatic() - * @generated - * @ordered - */ - protected static final int STATIC_EFLAG = 1 << 15; - - /** - * The default value of the '{@link #getJavaVisibility() <em>Java Visibility</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJavaVisibility() - * @generated - * @ordered - */ - protected static final JavaVisibilityKind JAVA_VISIBILITY_EDEFAULT = JavaVisibilityKind.PUBLIC_LITERAL; - - private transient boolean isGenerated = false; - - /** - * @generated This field/method will be replaced during code generation. - */ - protected JavaVisibilityKind javaVisibility = JAVA_VISIBILITY_EDEFAULT; - - /** - * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getParameters() - * @generated - * @ordered - */ - protected EList parameters = null; - - /** - * The cached value of the '{@link #getJavaExceptions() <em>Java Exceptions</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getJavaExceptions() - * @generated - * @ordered - */ - protected EList javaExceptions = null; - - /** - * The cached value of the '{@link #getSource() <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSource() - * @generated - * @ordered - */ - protected Block source = null; - - protected MethodImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getMethod(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isAbstractGen() { - return (eFlags & ABSTRACT_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setAbstract(boolean newAbstract) { - boolean oldAbstract = (eFlags & ABSTRACT_EFLAG) != 0; - if (newAbstract) eFlags |= ABSTRACT_EFLAG; else eFlags &= ~ABSTRACT_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__ABSTRACT, oldAbstract, newAbstract)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isNativeGen() { - return (eFlags & NATIVE_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setNative(boolean newNative) { - boolean oldNative = (eFlags & NATIVE_EFLAG) != 0; - if (newNative) eFlags |= NATIVE_EFLAG; else eFlags &= ~NATIVE_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__NATIVE, oldNative, newNative)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isSynchronizedGen() { - return (eFlags & SYNCHRONIZED_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSynchronized(boolean newSynchronized) { - boolean oldSynchronized = (eFlags & SYNCHRONIZED_EFLAG) != 0; - if (newSynchronized) eFlags |= SYNCHRONIZED_EFLAG; else eFlags &= ~SYNCHRONIZED_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__SYNCHRONIZED, oldSynchronized, newSynchronized)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isFinalGen() { - return (eFlags & FINAL_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFinal(boolean newFinal) { - boolean oldFinal = (eFlags & FINAL_EFLAG) != 0; - if (newFinal) eFlags |= FINAL_EFLAG; else eFlags &= ~FINAL_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__FINAL, oldFinal, newFinal)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isConstructorGen() { - return (eFlags & CONSTRUCTOR_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setConstructor(boolean newConstructor) { - boolean oldConstructor = (eFlags & CONSTRUCTOR_EFLAG) != 0; - if (newConstructor) eFlags |= CONSTRUCTOR_EFLAG; else eFlags &= ~CONSTRUCTOR_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__CONSTRUCTOR, oldConstructor, newConstructor)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isStaticGen() { - return (eFlags & STATIC_EFLAG) != 0; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setStatic(boolean newStatic) { - boolean oldStatic = (eFlags & STATIC_EFLAG) != 0; - if (newStatic) eFlags |= STATIC_EFLAG; else eFlags &= ~STATIC_EFLAG; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__STATIC, oldStatic, newStatic)); - } - - /** - * Return the java class that this method is defined in. - */ - public JavaClass getContainingJavaClass() { - return this.getJavaClass(); - } - - /** - * Overrides to ensure reflection is done. - */ - public boolean isAbstract() { - reflectValues(); - return isAbstractGen(); - } - - public boolean isConstructor() { - reflectValues(); - return isConstructorGen(); - } - - public boolean isFinal() { - reflectValues(); - return isFinalGen(); - } - - public boolean isNative() { - reflectValues(); - return isNativeGen(); - } - - public boolean isStatic() { - reflectValues(); - return isStaticGen(); - } - - public boolean isSynchronized() { - reflectValues(); - return isSynchronizedGen(); - } - - public EList getJavaExceptions() { - reflectValues(); - return getJavaExceptionsGen(); - } - - public JavaVisibilityKind getJavaVisibility() { - reflectValues(); - return getJavaVisibilityGen(); - } - - public EList getParameters() { - reflectValues(); - return getParametersGen(); - } - - /** - * @see org.eclipse.emf.ecore.ETypedElement#getEType() - */ - public EClassifier getEType() { - reflectValues(); - return super.getEType(); - } - - /** - * Return a String with the the method name and its parameters. e.g. <code> setFirstName(java.lang.String) <//code> . - * - */ - public String getMethodElementSignature() { - StringBuffer sb = new StringBuffer(75); - sb.append(getName()); - sb.append("("); - List params = getParameters(); - JavaParameter param; - int parmSize = params.size(); - int commaTest = 0; - for (int j = 0; j < parmSize; j++) { - if (j > commaTest) { - sb.append(","); - } - param = (JavaParameter) params.get(j); - //FB if (param.isReturn()) { - //FB commaTest ++; - //FB continue; - //FB } - sb.append(((JavaHelpers) param.getEType()).getQualifiedName()); - } - sb.append(")"); - return sb.toString(); - } - - /** - * Return a Parameter with the passed name, or null. - */ - public JavaParameter getParameter(String parameterName) { - List parms = getParameters(); - JavaParameter parm; - int parmSize = parms.size(); - for (int j = 0; j < parmSize; j++) { - parm = (JavaParameter) parms.get(j); - if (parm.getName().equals(parameterName)) - return parm; - } - return null; - } - - private static final int NOT_REFLECTED = 0x0, REFLECTED_BASE = 0x1, REFLECTED_GENERATED = 0x2; - - protected int reflectionStatus = NOT_REFLECTED; - - protected void reflectValues() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_BASE) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = readAdaptor.reflectValuesIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - reflectionStatus |= REFLECTED_BASE; - } - } - } - - /* - * This is not meant to be used outside of the reflection adapters. - */ - public synchronized ReadAdaptor getReadAdapter() { - return (ReadAdaptor) EcoreUtil.getRegisteredAdapter(this, ReadAdaptor.TYPE_KEY); - } - - /* - * Used by reflection adapter to clear the reflection. This not intended to be used by others. - */ - public synchronized void setReflected(boolean reflected) { - if (!reflected) - reflectionStatus = NOT_REFLECTED; - } - - /** - * Get the return type. - */ - public JavaHelpers getReturnType() { - return (JavaHelpers) getEType(); - } - - public String getSignature() { - if (signature == null) - signature = doGetSignature(); - return signature; - } - - /** - * Replicate the functionality of java.lang.reflect.Method.toString(). - * - * Returns a string describing this Method. The string is formatted as the method access modifiers, if any, followed by the method return type, - * followed by a space, followed by the class declaring the method, followed by a period, followed by the method name, followed by a - * parenthesized, comma-separated list of the method's formal parameter types. If the method throws checked exceptions, the parameter list is - * followed by a space, followed by the word throws followed by a comma-separated list of the thrown exception types. - * - * For example: - * - * public boolean java.lang.Object.equals(java.lang.Object) - * - * The access modifiers are placed in canonical order as specified by "The Java Language Specification". This is public, - * <tt>protected<//tt> or <tt>private<//tt> first, and then other modifiers in the following order: <tt>abstract<//tt>, <tt>static<//tt>, <tt>final<//tt>, <tt>synchronized<//tt> <tt>native<//tt>. - - */ - protected String doGetSignature() { - StringBuffer sb = new StringBuffer(); - switch (getJavaVisibility().getValue()) { - case JavaVisibilityKind.PUBLIC: - sb.append("Public "); - break; - case JavaVisibilityKind.PROTECTED: - sb.append("Protected "); - break; - case JavaVisibilityKind.PRIVATE: - sb.append("Private "); - break; - case JavaVisibilityKind.PACKAGE: - sb.append("Package "); - break; - } - if (isAbstract()) - sb.append("abstract "); - if (isStatic()) - sb.append("static "); - if (isFinal()) - sb.append("final "); - if (isSynchronized()) - sb.append("synchronized "); - if (isNative()) - sb.append("native "); - if (isVoid()) - sb.append("void "); - else - sb.append(getReturnType().getQualifiedName() + " "); - sb.append(getContainingJavaClass().getJavaName() + "."); - sb.append(getName() + "("); - List params = getParameters(); - JavaParameter param; - int parmSize = params.size(); - for (int j = 0; j < parmSize; j++) { - param = (JavaParameter) params.get(j); - //FB if (param.isReturn()) - //FB continue; // listParameters() includes return type in array - sb.append(((JavaHelpers) param.getEType()).getQualifiedName()); - if (j < (params.size() - 1)) { - sb.append(","); - } - } - sb.append(")"); - List exceptions = getJavaExceptions(); - JavaClass exception; - if (exceptions.size() > 0) { - sb.append(" throws "); - for (int k = 0; k < exceptions.size(); k++) { - exception = (JavaClass) exceptions.get(k); - sb.append(exception.getJavaName()); - if (k < (exceptions.size() - 1)) { - sb.append(","); - } - } - } - return sb.toString(); - } - - protected void reflectGenerated() { - // We only want the testing of the hasReflected and get readadapter to be sync(this) so that - // it is short and no deadlock possibility (this is because the the method reflection adapter may go - // back to the containing java class to get its reflection adapter, which would lock on itself. So - // we need to keep the sections that are sync(this) to not be deadlockable by not doing significant work - // during the sync. - ReadAdaptor readAdaptor = null; - synchronized (this) { - if ((reflectionStatus & REFLECTED_GENERATED) == 0) { - readAdaptor = getReadAdapter(); - } - } - if (readAdaptor != null) { - boolean setReflected = ((IJavaMethodAdapter) readAdaptor).reflectGeneratedIfNecessary(); - synchronized (this) { - // Don't want to set it false. That is job of reflection adapter. Otherwise we could have a race. - if (setReflected) - reflectionStatus |= (REFLECTED_GENERATED | REFLECTED_BASE); // We can be certain base will be done by reflect generated if not already - // done. - } - } - } - - /** - * Returns true if the method is system generated. This is usually determined by the "generated" tag in the comment. - */ - public boolean isGenerated() { - reflectGenerated(); - return isGenerated; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - */ - public boolean isGeneratedGen() { - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * Is this a void return type method. - */ - public boolean isVoid() { - //FB return (getReturnParameter() == null || "void".equals(getReturnType().getName())); - return (getReturnType() == null || "void".equals(getReturnType().getName())); - } - - public JavaParameter[] listParametersWithoutReturn() { - Collection v = getParameters(); - JavaParameter[] result = new JavaParameter[v.size()]; - v.toArray(result); - return result; - } - - public EList eContents() { - EList results = new BasicEList(); - results.addAll(getParametersGen()); //FB - return results; - } - - /** - * Set the isGenerated flag. - */ - public void setIsGenerated(boolean generated) { - isGenerated = generated; - } - - /** - * Set the return type - */ - public void setReturnType(JavaHelpers type) { - this.setEType(type); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaVisibilityKind getJavaVisibilityGen() { - return javaVisibility; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJavaVisibility(JavaVisibilityKind newJavaVisibility) { - JavaVisibilityKind oldJavaVisibility = javaVisibility; - javaVisibility = newJavaVisibility == null ? JAVA_VISIBILITY_EDEFAULT : newJavaVisibility; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__JAVA_VISIBILITY, oldJavaVisibility, javaVisibility)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public JavaClass getJavaClass() { - if (eContainerFeatureID != JavaRefPackage.METHOD__JAVA_CLASS) return null; - return (JavaClass)eContainer; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setJavaClass(JavaClass newJavaClass) { - if (newJavaClass != eContainer || (eContainerFeatureID != JavaRefPackage.METHOD__JAVA_CLASS && newJavaClass != null)) { - if (EcoreUtil.isAncestor(this, newJavaClass)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newJavaClass != null) - msgs = ((InternalEObject)newJavaClass).eInverseAdd(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs); - msgs = eBasicSetContainer((InternalEObject)newJavaClass, JavaRefPackage.METHOD__JAVA_CLASS, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__JAVA_CLASS, newJavaClass, newJavaClass)); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public Block getSource() { - if (source != null && source.eIsProxy()) { - Block oldSource = source; - source = (Block)eResolveProxy((InternalEObject)source); - if (source != oldSource) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaRefPackage.METHOD__SOURCE, oldSource, source)); - } - } - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Block basicGetSource() { - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSource(Block newSource) { - Block oldSource = source; - source = newSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaRefPackage.METHOD__SOURCE, oldSource, source)); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - return eAnnotations != null && !eAnnotations.isEmpty(); - case JavaRefPackage.METHOD__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.METHOD__ORDERED: - return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT; - case JavaRefPackage.METHOD__UNIQUE: - return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT; - case JavaRefPackage.METHOD__LOWER_BOUND: - return lowerBound != LOWER_BOUND_EDEFAULT; - case JavaRefPackage.METHOD__UPPER_BOUND: - return upperBound != UPPER_BOUND_EDEFAULT; - case JavaRefPackage.METHOD__MANY: - return isMany() != MANY_EDEFAULT; - case JavaRefPackage.METHOD__REQUIRED: - return isRequired() != REQUIRED_EDEFAULT; - case JavaRefPackage.METHOD__ETYPE: - return eType != null; - case JavaRefPackage.METHOD__ECONTAINING_CLASS: - return getEContainingClass() != null; - case JavaRefPackage.METHOD__EPARAMETERS: - return eParameters != null && !eParameters.isEmpty(); - case JavaRefPackage.METHOD__EEXCEPTIONS: - return eExceptions != null && !eExceptions.isEmpty(); - case JavaRefPackage.METHOD__ABSTRACT: - return ((eFlags & ABSTRACT_EFLAG) != 0) != ABSTRACT_EDEFAULT; - case JavaRefPackage.METHOD__NATIVE: - return ((eFlags & NATIVE_EFLAG) != 0) != NATIVE_EDEFAULT; - case JavaRefPackage.METHOD__SYNCHRONIZED: - return ((eFlags & SYNCHRONIZED_EFLAG) != 0) != SYNCHRONIZED_EDEFAULT; - case JavaRefPackage.METHOD__FINAL: - return ((eFlags & FINAL_EFLAG) != 0) != FINAL_EDEFAULT; - case JavaRefPackage.METHOD__CONSTRUCTOR: - return ((eFlags & CONSTRUCTOR_EFLAG) != 0) != CONSTRUCTOR_EDEFAULT; - case JavaRefPackage.METHOD__STATIC: - return ((eFlags & STATIC_EFLAG) != 0) != STATIC_EDEFAULT; - case JavaRefPackage.METHOD__JAVA_VISIBILITY: - return javaVisibility != JAVA_VISIBILITY_EDEFAULT; - case JavaRefPackage.METHOD__PARAMETERS: - return parameters != null && !parameters.isEmpty(); - case JavaRefPackage.METHOD__JAVA_EXCEPTIONS: - return javaExceptions != null && !javaExceptions.isEmpty(); - case JavaRefPackage.METHOD__JAVA_CLASS: - return getJavaClass() != null; - case JavaRefPackage.METHOD__SOURCE: - return source != null; - } - return eDynamicIsSet(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - getEAnnotations().clear(); - getEAnnotations().addAll((Collection)newValue); - return; - case JavaRefPackage.METHOD__NAME: - setName((String)newValue); - return; - case JavaRefPackage.METHOD__ORDERED: - setOrdered(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__UNIQUE: - setUnique(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__LOWER_BOUND: - setLowerBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.METHOD__UPPER_BOUND: - setUpperBound(((Integer)newValue).intValue()); - return; - case JavaRefPackage.METHOD__ETYPE: - setEType((EClassifier)newValue); - return; - case JavaRefPackage.METHOD__EPARAMETERS: - getEParameters().clear(); - getEParameters().addAll((Collection)newValue); - return; - case JavaRefPackage.METHOD__EEXCEPTIONS: - getEExceptions().clear(); - getEExceptions().addAll((Collection)newValue); - return; - case JavaRefPackage.METHOD__ABSTRACT: - setAbstract(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__NATIVE: - setNative(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__SYNCHRONIZED: - setSynchronized(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__FINAL: - setFinal(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__CONSTRUCTOR: - setConstructor(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__STATIC: - setStatic(((Boolean)newValue).booleanValue()); - return; - case JavaRefPackage.METHOD__JAVA_VISIBILITY: - setJavaVisibility((JavaVisibilityKind)newValue); - return; - case JavaRefPackage.METHOD__PARAMETERS: - getParameters().clear(); - getParameters().addAll((Collection)newValue); - return; - case JavaRefPackage.METHOD__JAVA_EXCEPTIONS: - getJavaExceptions().clear(); - getJavaExceptions().addAll((Collection)newValue); - return; - case JavaRefPackage.METHOD__JAVA_CLASS: - setJavaClass((JavaClass)newValue); - return; - case JavaRefPackage.METHOD__SOURCE: - setSource((Block)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - getEAnnotations().clear(); - return; - case JavaRefPackage.METHOD__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.METHOD__ORDERED: - setOrdered(ORDERED_EDEFAULT); - return; - case JavaRefPackage.METHOD__UNIQUE: - setUnique(UNIQUE_EDEFAULT); - return; - case JavaRefPackage.METHOD__LOWER_BOUND: - setLowerBound(LOWER_BOUND_EDEFAULT); - return; - case JavaRefPackage.METHOD__UPPER_BOUND: - setUpperBound(UPPER_BOUND_EDEFAULT); - return; - case JavaRefPackage.METHOD__ETYPE: - setEType((EClassifier)null); - return; - case JavaRefPackage.METHOD__EPARAMETERS: - getEParameters().clear(); - return; - case JavaRefPackage.METHOD__EEXCEPTIONS: - getEExceptions().clear(); - return; - case JavaRefPackage.METHOD__ABSTRACT: - setAbstract(ABSTRACT_EDEFAULT); - return; - case JavaRefPackage.METHOD__NATIVE: - setNative(NATIVE_EDEFAULT); - return; - case JavaRefPackage.METHOD__SYNCHRONIZED: - setSynchronized(SYNCHRONIZED_EDEFAULT); - return; - case JavaRefPackage.METHOD__FINAL: - setFinal(FINAL_EDEFAULT); - return; - case JavaRefPackage.METHOD__CONSTRUCTOR: - setConstructor(CONSTRUCTOR_EDEFAULT); - return; - case JavaRefPackage.METHOD__STATIC: - setStatic(STATIC_EDEFAULT); - return; - case JavaRefPackage.METHOD__JAVA_VISIBILITY: - setJavaVisibility(JAVA_VISIBILITY_EDEFAULT); - return; - case JavaRefPackage.METHOD__PARAMETERS: - getParameters().clear(); - return; - case JavaRefPackage.METHOD__JAVA_EXCEPTIONS: - getJavaExceptions().clear(); - return; - case JavaRefPackage.METHOD__JAVA_CLASS: - setJavaClass((JavaClass)null); - return; - case JavaRefPackage.METHOD__SOURCE: - setSource((Block)null); - return; - } - eDynamicUnset(eFeature); - } - - /** - * @generated This field/method will be replaced during code generation. - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (abstract: "); - result.append((eFlags & ABSTRACT_EFLAG) != 0); - result.append(", native: "); - result.append((eFlags & NATIVE_EFLAG) != 0); - result.append(", synchronized: "); - result.append((eFlags & SYNCHRONIZED_EFLAG) != 0); - result.append(", final: "); - result.append((eFlags & FINAL_EFLAG) != 0); - result.append(", constructor: "); - result.append((eFlags & CONSTRUCTOR_EFLAG) != 0); - result.append(", static: "); - result.append((eFlags & STATIC_EFLAG) != 0); - result.append(", javaVisibility: "); - result.append(javaVisibility); - result.append(')'); - return result.toString(); - } - - /** - * @generated This field/method will be replaced during code generation - */ - public EList getParametersGen() { - if (parameters == null) { - parameters = new EObjectContainmentEList(JavaParameter.class, this, JavaRefPackage.METHOD__PARAMETERS); - } - return parameters; - } - - /** - * @generated This field/method will be replaced during code generation - */ - public EList getJavaExceptionsGen() { - if (javaExceptions == null) { - javaExceptions = new EObjectResolvingEList(JavaClass.class, this, JavaRefPackage.METHOD__JAVA_EXCEPTIONS); - } - return javaExceptions; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); - case JavaRefPackage.METHOD__ECONTAINING_CLASS: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.METHOD__ECONTAINING_CLASS, msgs); - case JavaRefPackage.METHOD__EPARAMETERS: - return ((InternalEList)getEParameters()).basicAdd(otherEnd, msgs); - case JavaRefPackage.METHOD__JAVA_CLASS: - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, JavaRefPackage.METHOD__JAVA_CLASS, msgs); - default: - return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); - } - } - if (eContainer != null) - msgs = eBasicRemoveFromContainer(msgs); - return eBasicSetContainer(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); - case JavaRefPackage.METHOD__ECONTAINING_CLASS: - return eBasicSetContainer(null, JavaRefPackage.METHOD__ECONTAINING_CLASS, msgs); - case JavaRefPackage.METHOD__EPARAMETERS: - return ((InternalEList)getEParameters()).basicRemove(otherEnd, msgs); - case JavaRefPackage.METHOD__PARAMETERS: - return ((InternalEList)getParameters()).basicRemove(otherEnd, msgs); - case JavaRefPackage.METHOD__JAVA_CLASS: - return eBasicSetContainer(null, JavaRefPackage.METHOD__JAVA_CLASS, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { - if (eContainerFeatureID >= 0) { - switch (eContainerFeatureID) { - case JavaRefPackage.METHOD__ECONTAINING_CLASS: - return eContainer.eInverseRemove(this, EcorePackage.ECLASS__EOPERATIONS, EClass.class, msgs); - case JavaRefPackage.METHOD__JAVA_CLASS: - return eContainer.eInverseRemove(this, JavaRefPackage.JAVA_CLASS__METHODS, JavaClass.class, msgs); - default: - return eDynamicBasicRemoveFromContainer(msgs); - } - } - return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.METHOD__EANNOTATIONS: - return getEAnnotations(); - case JavaRefPackage.METHOD__NAME: - return getName(); - case JavaRefPackage.METHOD__ORDERED: - return isOrdered() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__UNIQUE: - return isUnique() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__LOWER_BOUND: - return new Integer(getLowerBound()); - case JavaRefPackage.METHOD__UPPER_BOUND: - return new Integer(getUpperBound()); - case JavaRefPackage.METHOD__MANY: - return isMany() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__REQUIRED: - return isRequired() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__ETYPE: - if (resolve) return getEType(); - return basicGetEType(); - case JavaRefPackage.METHOD__ECONTAINING_CLASS: - return getEContainingClass(); - case JavaRefPackage.METHOD__EPARAMETERS: - return getEParameters(); - case JavaRefPackage.METHOD__EEXCEPTIONS: - return getEExceptions(); - case JavaRefPackage.METHOD__ABSTRACT: - return isAbstract() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__NATIVE: - return isNative() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__SYNCHRONIZED: - return isSynchronized() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__FINAL: - return isFinal() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__CONSTRUCTOR: - return isConstructor() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__STATIC: - return isStatic() ? Boolean.TRUE : Boolean.FALSE; - case JavaRefPackage.METHOD__JAVA_VISIBILITY: - return getJavaVisibility(); - case JavaRefPackage.METHOD__PARAMETERS: - return getParameters(); - case JavaRefPackage.METHOD__JAVA_EXCEPTIONS: - return getJavaExceptions(); - case JavaRefPackage.METHOD__JAVA_CLASS: - return getJavaClass(); - case JavaRefPackage.METHOD__SOURCE: - if (resolve) return getSource(); - return basicGetSource(); - } - return eDynamicGet(eFeature, resolve); - } - -} - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/StatementImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/StatementImpl.java deleted file mode 100644 index 8ea3905a5..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/StatementImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: StatementImpl.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.jem.java.JavaRefPackage; -import org.eclipse.jem.java.Statement; -/** - * @generated - */ -public class StatementImpl extends BlockImpl implements Statement{ - - protected StatementImpl() { - super(); - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return JavaRefPackage.eINSTANCE.getStatement(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { - if (featureID >= 0) { - switch (eDerivedStructuralFeatureID(featureID, baseClass)) { - case JavaRefPackage.STATEMENT__CONTENTS: - return ((InternalEList)getContents()).basicRemove(otherEnd, msgs); - default: - return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); - } - } - return eBasicSetContainer(null, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(EStructuralFeature eFeature, boolean resolve) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.STATEMENT__SOURCE: - return getSource(); - case JavaRefPackage.STATEMENT__NAME: - return getName(); - case JavaRefPackage.STATEMENT__CONTENTS: - return getContents(); - } - return eDynamicGet(eFeature, resolve); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(EStructuralFeature eFeature, Object newValue) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.STATEMENT__SOURCE: - setSource((String)newValue); - return; - case JavaRefPackage.STATEMENT__NAME: - setName((String)newValue); - return; - case JavaRefPackage.STATEMENT__CONTENTS: - getContents().clear(); - getContents().addAll((Collection)newValue); - return; - } - eDynamicSet(eFeature, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.STATEMENT__SOURCE: - setSource(SOURCE_EDEFAULT); - return; - case JavaRefPackage.STATEMENT__NAME: - setName(NAME_EDEFAULT); - return; - case JavaRefPackage.STATEMENT__CONTENTS: - getContents().clear(); - return; - } - eDynamicUnset(eFeature); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(EStructuralFeature eFeature) { - switch (eDerivedStructuralFeatureID(eFeature)) { - case JavaRefPackage.STATEMENT__SOURCE: - return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT.equals(source); - case JavaRefPackage.STATEMENT__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case JavaRefPackage.STATEMENT__CONTENTS: - return contents != null && !contents.isEmpty(); - } - return eDynamicIsSet(eFeature); - } - -} - - - - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/URL.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/URL.java deleted file mode 100644 index 4b6febd2f..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/URL.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.internal.impl; -/* - * $RCSfile: URL.java,v $ - * $Revision: 1.1 $ $Date: 2005/09/14 23:30:32 $ - */ -import java.util.ArrayList; -import java.util.List; - -public class URL { - public String namespaceName; - public String ID; - List attributeNames; -/** - * URL constructor comment. - */ -public URL(String urlString) { - initializeFromString(urlString); -} -/** - * URL constructor comment. - */ -public URL(String nameSpaceName, String anID) { - this.namespaceName = nameSpaceName; - this.ID = anID; -} -public List getAttributeNames() { - return attributeNames; -} -public void initializeFromString(String urlString) { - int poundInx = urlString.lastIndexOf('#'); - if (poundInx > -1) { - namespaceName = urlString.substring(0, poundInx); - urlString = urlString.substring(poundInx + 1); - int dotIndex = urlString.indexOf("->"); //$NON-NLS-1$ - if (dotIndex > -1) { - ID = urlString.substring(0, dotIndex); - String attributeNameString = urlString.substring(dotIndex + 2); - attributeNames = new ArrayList(); - do { - dotIndex = attributeNameString.indexOf("->"); //$NON-NLS-1$ - if (dotIndex > -1) { - attributeNames.add(attributeNameString.substring(0, dotIndex)); - attributeNameString = attributeNameString.substring(dotIndex + 2); - } else - attributeNames.add(attributeNameString); - } while (dotIndex > -1); - } else { - ID = urlString; - } - } else { - // assume that any URL string that ends with .xmi is a namespace. - if (urlString.endsWith(".xmi")){ //$NON-NLS-1$ - namespaceName = urlString; - ID = null; - } else { - namespaceName = "?defaultURL?"; //$NON-NLS-1$ - ID = urlString; - } - } -} -public String toString() { - return "URL(" + ((namespaceName == null) ? "" : namespaceName + "#") + ((ID == null) ? "" : ID) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ -} -} - - diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaContext.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaContext.java deleted file mode 100644 index 4e8d07ba2..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaContext.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: JavaContext.java,v $ - * $Revision: 1.1 $ $Date: 2006/01/13 23:46:51 $ - */ -package org.eclipse.jem.java.util; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; - -import org.eclipse.jem.internal.java.adapters.jdk.JavaJDKAdapterFactory; - -/** - * Static helper class to handle the java context. The java context is a resource set - * that has the appropriate reflection adapter attached, either for java reflection or - * for JDT reflection. The default is for java reflection. When running in Eclipse it - * will be the JDT reflection. - * <p> - * <b>Note:</b>This should only be used by customers that are not doing normal Eclipse JDT JEM - * reflection. Normal JEM should be using the JEM EMF nature access instead. - * @since 1.2.0 - */ -public class JavaContext { - - private static Class ReflectionFactoryClass = JavaJDKAdapterFactory.class; - - private JavaContext() { - - } - - /** - * Create the java context. To be used outside of Eclipse. - * Within normal Eclipse JEM usage the JEM EMF nature should be used instead. - * @return - * - * @since 1.2.0 - */ - public static ResourceSet createJavaContext() { - org.eclipse.jem.internal.java.init.JavaInit.init(); - ResourceSet set = new ResourceSetImpl(); - set.getAdapterFactories().add(createJavaReflectionAdapterFactory()); - return set; - } - - private static AdapterFactory createJavaReflectionAdapterFactory() { - AdapterFactory factoryInstance = null; - try { - if (getReflectionAdapterFactoryClass() != null) - factoryInstance = (AdapterFactory) getReflectionAdapterFactoryClass().newInstance(); - } catch (Exception e) { - // Reflection or instantiation problems. - // OK, can't do Java Model reflection - } - return factoryInstance; - } - - /** - * Return the Class for the Java refection adapter factory. - * @return - * - * @since 1.2.0 - */ - public static Class getReflectionAdapterFactoryClass() { - return ReflectionFactoryClass; - } - - /** - * Set the Class for the Java refection adapter factory. Within Eclipse this should not - * be set by customers. - * - * @param javaReflectionFactoryClass - * - * @since 1.2.0 - */ - public static void setReflectionAdapterFactoryClass(Class javaReflectionFactoryClass) { - ReflectionFactoryClass = javaReflectionFactoryClass; - } - - -} diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefAdapterFactory.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefAdapterFactory.java deleted file mode 100644 index 469898c1a..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefAdapterFactory.java +++ /dev/null @@ -1,478 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.util; -/* - * $RCSfile: JavaRefAdapterFactory.java,v $ - * $Revision: 1.6 $ $Date: 2005/08/24 20:20:24 $ - */ -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; - -import org.eclipse.jem.java.*; - - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jem.java.JavaRefPackage - * @generated - */ -public class JavaRefAdapterFactory extends AdapterFactoryImpl -{ - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JavaRefPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaRefAdapterFactory() { - if (modelPackage == null) { - modelPackage = JavaRefPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JavaRefSwitch modelSwitch = - new JavaRefSwitch() { - public Object caseJavaClass(JavaClass object) { - return createJavaClassAdapter(); - } - public Object caseInitializer(Initializer object) { - return createInitializerAdapter(); - } - public Object caseJavaParameter(JavaParameter object) { - return createJavaParameterAdapter(); - } - public Object caseMethod(Method object) { - return createMethodAdapter(); - } - public Object caseField(Field object) { - return createFieldAdapter(); - } - public Object caseBlock(Block object) { - return createBlockAdapter(); - } - public Object caseComment(Comment object) { - return createCommentAdapter(); - } - public Object caseStatement(Statement object) { - return createStatementAdapter(); - } - public Object caseJavaPackage(JavaPackage object) { - return createJavaPackageAdapter(); - } - public Object caseJavaDataType(JavaDataType object) { - return createJavaDataTypeAdapter(); - } - public Object caseArrayType(ArrayType object) { - return createArrayTypeAdapter(); - } - public Object caseJavaEvent(JavaEvent object) { - return createJavaEventAdapter(); - } - public Object caseEModelElement(EModelElement object) { - return createEModelElementAdapter(); - } - public Object caseENamedElement(ENamedElement object) { - return createENamedElementAdapter(); - } - public Object caseEClassifier(EClassifier object) { - return createEClassifierAdapter(); - } - public Object caseEClass(EClass object) { - return createEClassAdapter(); - } - public Object caseETypedElement(ETypedElement object) { - return createETypedElementAdapter(); - } - public Object caseEParameter(EParameter object) { - return createEParameterAdapter(); - } - public Object caseEOperation(EOperation object) { - return createEOperationAdapter(); - } - public Object caseEPackage(EPackage object) { - return createEPackageAdapter(); - } - public Object caseEStructuralFeature(EStructuralFeature object) { - return createEStructuralFeatureAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.JavaClass <em>Java Class</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.JavaClass - * @generated - */ - public Adapter createJavaClassAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Initializer <em>Initializer</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Initializer - * @generated - */ - public Adapter createInitializerAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.JavaParameter <em>Java Parameter</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.JavaParameter - * @generated - */ - public Adapter createJavaParameterAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Method <em>Method</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Method - * @generated - */ - public Adapter createMethodAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Field <em>Field</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Field - * @generated - */ - public Adapter createFieldAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Block <em>Block</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Block - * @generated - */ - public Adapter createBlockAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Comment <em>Comment</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Comment - * @generated - */ - public Adapter createCommentAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.Statement <em>Statement</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.Statement - * @generated - */ - public Adapter createStatementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.JavaPackage <em>Java Package</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.JavaPackage - * @generated - */ - public Adapter createJavaPackageAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.JavaDataType <em>Java Data Type</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.JavaDataType - * @generated - */ - public Adapter createJavaDataTypeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.ArrayType <em>Array Type</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.ArrayType - * @generated - */ - public Adapter createArrayTypeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jem.java.JavaEvent <em>Java Event</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jem.java.JavaEvent - * @generated - */ - public Adapter createJavaEventAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EModelElement - * @generated - */ - public Adapter createEModelElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.ENamedElement - * @generated - */ - public Adapter createENamedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EClassifier - * @generated - */ - public Adapter createEClassifierAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClass <em>EClass</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EClass - * @generated - */ - public Adapter createEClassAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.ETypedElement - * @generated - */ - public Adapter createETypedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EParameter <em>EParameter</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EParameter - * @generated - */ - public Adapter createEParameterAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EOperation <em>EOperation</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EOperation - * @generated - */ - public Adapter createEOperationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EStructuralFeature <em>EStructural Feature</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EStructuralFeature - * @generated - */ - public Adapter createEStructuralFeatureAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EPackage - * @generated - */ - public Adapter createEPackageAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //JavaRefAdapterFactory diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefSwitch.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefSwitch.java deleted file mode 100644 index 1c7edff5b..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/JavaRefSwitch.java +++ /dev/null @@ -1,547 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.java.util; - -/* - * $RCSfile: JavaRefSwitch.java,v $ - * $Revision: 1.7 $ $Date: 2005/08/24 20:20:24 $ - */ -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; - -import org.eclipse.jem.java.*; - - - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jem.java.JavaRefPackage - * @generated - */ -public class JavaRefSwitch { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JavaRefPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaRefSwitch() { - if (modelPackage == null) { - modelPackage = JavaRefPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case JavaRefPackage.JAVA_CLASS: { - JavaClass javaClass = (JavaClass)theEObject; - Object result = caseJavaClass(javaClass); - if (result == null) result = caseEClass(javaClass); - if (result == null) result = caseEClassifier(javaClass); - if (result == null) result = caseENamedElement(javaClass); - if (result == null) result = caseEModelElement(javaClass); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.INITIALIZER: { - Initializer initializer = (Initializer)theEObject; - Object result = caseInitializer(initializer); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.JAVA_PARAMETER: { - JavaParameter javaParameter = (JavaParameter)theEObject; - Object result = caseJavaParameter(javaParameter); - if (result == null) result = caseEParameter(javaParameter); - if (result == null) result = caseETypedElement(javaParameter); - if (result == null) result = caseENamedElement(javaParameter); - if (result == null) result = caseEModelElement(javaParameter); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.METHOD: { - Method method = (Method)theEObject; - Object result = caseMethod(method); - if (result == null) result = caseEOperation(method); - if (result == null) result = caseETypedElement(method); - if (result == null) result = caseENamedElement(method); - if (result == null) result = caseEModelElement(method); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.FIELD: { - Field field = (Field)theEObject; - Object result = caseField(field); - if (result == null) result = caseETypedElement(field); - if (result == null) result = caseENamedElement(field); - if (result == null) result = caseEModelElement(field); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.BLOCK: { - Block block = (Block)theEObject; - Object result = caseBlock(block); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.COMMENT: { - Comment comment = (Comment)theEObject; - Object result = caseComment(comment); - if (result == null) result = caseBlock(comment); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.STATEMENT: { - Statement statement = (Statement)theEObject; - Object result = caseStatement(statement); - if (result == null) result = caseBlock(statement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.JAVA_PACKAGE: { - JavaPackage javaPackage = (JavaPackage)theEObject; - Object result = caseJavaPackage(javaPackage); - if (result == null) result = caseEPackage(javaPackage); - if (result == null) result = caseENamedElement(javaPackage); - if (result == null) result = caseEModelElement(javaPackage); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.JAVA_DATA_TYPE: { - JavaDataType javaDataType = (JavaDataType)theEObject; - Object result = caseJavaDataType(javaDataType); - if (result == null) result = caseEClass(javaDataType); - if (result == null) result = caseEClassifier(javaDataType); - if (result == null) result = caseENamedElement(javaDataType); - if (result == null) result = caseEModelElement(javaDataType); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.ARRAY_TYPE: { - ArrayType arrayType = (ArrayType)theEObject; - Object result = caseArrayType(arrayType); - if (result == null) result = caseJavaClass(arrayType); - if (result == null) result = caseEClass(arrayType); - if (result == null) result = caseEClassifier(arrayType); - if (result == null) result = caseENamedElement(arrayType); - if (result == null) result = caseEModelElement(arrayType); - if (result == null) result = defaultCase(theEObject); - return result; - } - case JavaRefPackage.JAVA_EVENT: { - JavaEvent javaEvent = (JavaEvent)theEObject; - Object result = caseJavaEvent(javaEvent); - if (result == null) result = caseEStructuralFeature(javaEvent); - if (result == null) result = caseETypedElement(javaEvent); - if (result == null) result = caseENamedElement(javaEvent); - if (result == null) result = caseEModelElement(javaEvent); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Java Class</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Java Class</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJavaClass(JavaClass object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Initializer</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Initializer</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseInitializer(Initializer object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Java Parameter</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Java Parameter</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJavaParameter(JavaParameter object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Method</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Method</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseMethod(Method object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Field</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Field</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseField(Field object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Block</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Block</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseBlock(Block object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Comment</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Comment</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseComment(Comment object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Statement</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Statement</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseStatement(Statement object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Java Package</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Java Package</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJavaPackage(JavaPackage object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Java Data Type</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Java Data Type</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJavaDataType(JavaDataType object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Array Type</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Array Type</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseArrayType(ArrayType object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Java Event</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Java Event</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseJavaEvent(JavaEvent object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EModel Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EModel Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEModelElement(EModelElement object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>ENamed Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>ENamed Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseENamedElement(ENamedElement object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EClassifier</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EClassifier</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEClassifier(EClassifier object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EClass</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EClass</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEClass(EClass object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>ETyped Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>ETyped Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseETypedElement(ETypedElement object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EParameter</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EParameter</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEParameter(EParameter object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EOperation</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EOperation</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEOperation(EOperation object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EStructural Feature</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EStructural Feature</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEStructuralFeature(EStructuralFeature object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EPackage</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EPackage</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEPackage(EPackage object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //JavaRefSwitch diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/NotificationUtil.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/NotificationUtil.java deleted file mode 100644 index c479002ab..000000000 --- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/util/NotificationUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: NotificationUtil.java,v $ - * $Revision: 1.2 $ $Date: 2005/02/15 22:37:02 $ - */ -package org.eclipse.jem.java.util; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.jem.internal.java.adapters.JavaReflectionAdaptor; -import org.eclipse.jem.internal.java.adapters.ReflectionAdaptor; - - -/** - * This is a utility class of static methods for handling special JEM notifications. - * - * @since 1.1.0 - */ -public class NotificationUtil { - /* - * Not meant to be constructed. - */ - private NotificationUtil() { - - } - - /** - * Answer whether this notification is a reflection notification. If it is, then it means that the JavaClass has - * just had reflection performed on it. - * @param msg - * @return <code>true</code> if this is a reflection event. - * - * @since 1.1.0 - */ - public static boolean isReflectionEvent(Notification msg) { - return msg.getEventType() == ReflectionAdaptor.EVENT && msg.getFeature() == ReflectionAdaptor.REFLECTION_EVENT; - } - - /** - * Answer whether this notification is a reflection flush event of a JavaClass with existing code. If it is, then it means that the - * JavaClass has just had the reflection results flushed, AND this was a class that had either source or binary code on it.. - * @param msg - * @return <code>true</code> if this is a flush event. - * - * @since 1.1.0 - */ - public static boolean isFlushEvent(Notification msg) { - return msg.getEventType() == ReflectionAdaptor.EVENT && msg.getFeature() == JavaReflectionAdaptor.FLUSH_REFLECTION_EVENT; - } - - /** - * Answer whether this notification is a reflection flush event of a JavaClass that is new and doesn't have existing code. - * If it is, then it means that the JavaClass has just had the reflection results flushed, AND this was a class that was new and - * had no code behind it. - * @param msg - * @return <code>true</code> if this is a flush event of new class. - * - * @since 1.1.0 - */ - public static boolean isFlushNewEvent(Notification msg) { - return msg.getEventType() == ReflectionAdaptor.EVENT && msg.getFeature() == JavaReflectionAdaptor.FLUSH_NEW_REFLECTION_EVENT; - } - -} |