org.eclipse.emf.codegen.util
Class CodeGenUtil

java.lang.Object
  extended byorg.eclipse.emf.codegen.util.CodeGenUtil

public class CodeGenUtil
extends java.lang.Object

This class contains convenient static methods for EMF code generation.

This class, like much of the code in this plug-in, is currently undergoing change and should not be considered API.


Nested Class Summary
static class CodeGenUtil.StreamProgressMonitor
          This is a progress monitor that prints the progress information to a stream.
 
Constructor Summary
CodeGenUtil()
           
 
Method Summary
static void addClasspathEntries(java.util.Collection classpathEntries, java.lang.String pluginID)
           
static void addClasspathEntries(java.util.Collection classpathEntries, java.lang.String variableName, java.lang.String pluginID)
           
static java.lang.String capName(java.lang.String name)
           
static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, IPath localLocation, IProgressMonitor progressMonitor)
           
static IContainer findOrCreateContainer(IPath path, boolean forceRefresh, IProjectDescription projectDescription, IProgressMonitor progressMonitor)
           
static java.lang.String format(java.lang.String name, char separator, java.lang.String prefix, boolean includePrefix)
           
static java.util.List getClasspathPaths(java.lang.String pluginID)
           
static java.util.Set getJavaDefaultTypes()
          Returns the short names of the primitives and types in java.lang (i.e. those that don't need qualification).
static java.util.Set getJavaReservedWords()
          Returns the set of all Java's keywords and textual literals, as of Java 1.4.
static java.lang.String getPackageName(java.lang.String qualifiedClassName)
          Returns the package name for a qualified class name, ie, a substring from the first char until the last ".
static java.lang.String getSimpleClassName(java.lang.String qualifiedClassName)
          Returns the simple class name for a qualified class name, ie, a substring from starting after the last ".
static boolean isInJavaOutput(IResource resource)
           
static boolean isJavaDefaultType(java.lang.String s)
          Tests whether the given string is the name of a primitive or java.lang type.
static boolean isJavaLangType(java.lang.String s)
          Tests whether the given string is the name of a java.lang type.
static boolean isJavaPrimitiveType(java.lang.String s)
          Tests whether the given string is the name of a primitive type.
static boolean isJavaReservedWord(java.lang.String s)
          Tests whether a given string is a Java reserved word.
static char parseChar(java.lang.String c)
           
static java.util.List parseName(java.lang.String sourceName, char sourceSeparator)
          This method breaks sourceName into words delimited by sourceSeparator and/or mixed-case naming.
static java.lang.String parseString(java.lang.String s)
           
static java.lang.String safeName(java.lang.String name)
           
static java.lang.String uncapName(java.lang.String name)
           
static java.lang.String uncapPrefixedName(java.lang.String name, boolean forceDifferent)
           
static java.lang.String validJavaIdentifier(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeGenUtil

public CodeGenUtil()
Method Detail

getJavaReservedWords

public static java.util.Set getJavaReservedWords()
Returns the set of all Java's keywords and textual literals, as of Java 1.4.


getJavaDefaultTypes

public static java.util.Set getJavaDefaultTypes()
Returns the short names of the primitives and types in java.lang (i.e. those that don't need qualification).


isJavaReservedWord

public static boolean isJavaReservedWord(java.lang.String s)
Tests whether a given string is a Java reserved word.


isJavaDefaultType

public static boolean isJavaDefaultType(java.lang.String s)
Tests whether the given string is the name of a primitive or java.lang type.


isJavaLangType

public static boolean isJavaLangType(java.lang.String s)
Tests whether the given string is the name of a java.lang type.


isJavaPrimitiveType

public static boolean isJavaPrimitiveType(java.lang.String s)
Tests whether the given string is the name of a primitive type.


parseString

public static java.lang.String parseString(java.lang.String s)

parseChar

public static char parseChar(java.lang.String c)

validJavaIdentifier

public static java.lang.String validJavaIdentifier(java.lang.String name)

capName

public static java.lang.String capName(java.lang.String name)

uncapName

public static java.lang.String uncapName(java.lang.String name)

uncapPrefixedName

public static java.lang.String uncapPrefixedName(java.lang.String name,
                                                 boolean forceDifferent)

safeName

public static java.lang.String safeName(java.lang.String name)

format

public static java.lang.String format(java.lang.String name,
                                      char separator,
                                      java.lang.String prefix,
                                      boolean includePrefix)

parseName

public static java.util.List parseName(java.lang.String sourceName,
                                       char sourceSeparator)
This method breaks sourceName into words delimited by sourceSeparator and/or mixed-case naming.


isInJavaOutput

public static boolean isInJavaOutput(IResource resource)

findOrCreateContainer

public static IContainer findOrCreateContainer(IPath path,
                                               boolean forceRefresh,
                                               IPath localLocation,
                                               IProgressMonitor progressMonitor)
                                        throws CoreException
Throws:
CoreException

findOrCreateContainer

public static IContainer findOrCreateContainer(IPath path,
                                               boolean forceRefresh,
                                               IProjectDescription projectDescription,
                                               IProgressMonitor progressMonitor)
                                        throws CoreException
Throws:
CoreException

getClasspathPaths

public static java.util.List getClasspathPaths(java.lang.String pluginID)
                                        throws JETException
Throws:
JETException

addClasspathEntries

public static void addClasspathEntries(java.util.Collection classpathEntries,
                                       java.lang.String variableName,
                                       java.lang.String pluginID)
                                throws JETException
Throws:
JETException

addClasspathEntries

public static void addClasspathEntries(java.util.Collection classpathEntries,
                                       java.lang.String pluginID)
                                throws java.lang.Exception
Throws:
java.lang.Exception

getPackageName

public static java.lang.String getPackageName(java.lang.String qualifiedClassName)
Returns the package name for a qualified class name, ie, a substring from the first char until the last ".". If the argument is null or a non-qualified name, this method returns null.

Parameters:
qualifiedClassName -
Returns:
String

getSimpleClassName

public static java.lang.String getSimpleClassName(java.lang.String qualifiedClassName)
Returns the simple class name for a qualified class name, ie, a substring from starting after the last ".". If the argument is a non-qualified name, this method returns the argument.

Parameters:
qualifiedClassName -
Returns:
String

Copyright 2001-2004 IBM Corporation and others.
All Rights Reserved.