net.officefloor.eclipse.util
Class EclipseUtil

java.lang.Object
  extended by net.officefloor.eclipse.util.EclipseUtil

public class EclipseUtil
extends Object

Utility methods for working in Eclipse.

Author:
Daniel Sagenschneider

Method Summary
static
<L,I extends L>
void
addToList(List<L> list, I item)
          Convenience method to add an item to a list.
static org.eclipse.core.runtime.CoreException createCoreException(Throwable failure)
          Creates a CoreException from the input Throwable.
static
<T> T
createInstance(Class<T> clazz, AbstractOfficeFloorEditor<?,?> editor)
          Creates an instance of the class.
static
<S> S
createInstance(String className, Class<S> superType, AbstractOfficeFloorEditor<?,?> editor)
          Convenience method to create an instance of a class by its name.
static boolean isBlank(String value)
          Utility method to indicate if the input String is null or empty.
static
<S> Class<S>
obtainClass(String className, Class<S> superType, AbstractOfficeFloorEditor<?,?> editor)
          Obtains the Class by its name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isBlank

public static boolean isBlank(String value)
Utility method to indicate if the input String is null or empty.

Parameters:
value - Value to check if blank.
Returns:
True if value is null or empty.

obtainClass

public static <S> Class<S> obtainClass(String className,
                                       Class<S> superType,
                                       AbstractOfficeFloorEditor<?,?> editor)
Obtains the Class by its name.

Parameters:
className - Fully qualified name of the class.
superType - Type that the class must be a sub type.
editor - AbstractOfficeFloorEditor to report issues.
Returns:
Class or null if could not obtain.

createInstance

public static <T> T createInstance(Class<T> clazz,
                                   AbstractOfficeFloorEditor<?,?> editor)
Creates an instance of the class.

Parameters:
clazz - Class to create an instance from.
editor - AbstractOfficeFloorEditor to report issues.
Returns:
Instance of the class or null if unable to instantiate.

createInstance

public static <S> S createInstance(String className,
                                   Class<S> superType,
                                   AbstractOfficeFloorEditor<?,?> editor)
Convenience method to create an instance of a class by its name.

Parameters:
className - Fully qualified name of class.
superType - Type that the class of instance must be a sub type.
editor - AbstractOfficeFloorEditor to report issues.
Returns:
Instance or null if unable to instantiate.

createCoreException

public static org.eclipse.core.runtime.CoreException createCoreException(Throwable failure)
Creates a CoreException from the input Throwable.

Parameters:
failure - Throwable.
Returns:
CoreException.

addToList

public static <L,I extends L> void addToList(List<L> list,
                                             I item)
Convenience method to add an item to a list. Will not add to list if null.

Parameters:
list - List.
item - Item to be added to the list. Will not be added if null.


Copyright © 2005-2013. All Rights Reserved.