Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search



Logging with Log4j

See package org.eclipse.riena.core.logging.

Accessing files on disk with RienaLocations

The class org.eclipse.riena.core.RienaLocations with static methods getDataArea() and getDataArea(Bundle) should be the single place that manages and knows about where to read/write files on disk.

Always use RienaLocations when you need to read or write application-specific data (e.g. user settings or custom caches) to/from disk.


See package org.eclipse.riena.core.cache.

Util classes

All in package org.eclipse.riena.core.util. See the source files for a complete list of methods and the inline Javadoc for more information.


Helper for arrays.

public static <T> T[] copyRange(T[] source, int from, int to)
Copy from the given source array from index from to index to into a newly-created array of the same type with size to - from.


Helper for I/O operations, e.g.

public static void copyFile(File from, File to) throws IOException


This helper provides conversions from classes only implementing Iterator or Enumeration such that they can be used within the extended for()-loop (foreach). All the able() methods can be used with a null parameter. So, explicitly checking for null is not necessary! Note: All these methods induce a small performance penalty.

String[] strings = null;
for (String s : {
StringTokenizer st = new StringTokenizer("this is a test");
for (String str :, String.class)) {


Use this to explicitly document do-nothing behavior, e.g. in empty try-catch clauses:

Nop.reason("do nothing, can happen if some other bundle registered this service");


Helps with converting string representation of maps and lists to their Java counterparts.


Provides static methods that allow a grovvy-like experience for calling methods, setting and getting fields and creating instances. Both on accessible, i.e. public and inaccessible elements. And everything without fiddling around with the reflection API.

URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
URL url = new URL("file:c:\\");
ReflectionUtils.invokeHidden(sysloader, "addURL", url);


Offers static convenience methods like:

public static boolean isGiven(final CharSequence sequence)
the counterpart to isEmpty(...)
public static boolean isEmpty(final CharSequence sequence)
public static boolean isDeepEmpty(final String string)
like isEmpty, with the difference that whitespace-only strings are considered empty.
public static boolean equals(final CharSequence sequence1, final CharSequence sequence2)
null-safe equals


WeakRef simplifies the usage of WeakReferences. It provides a simple API that allows to define a notification callback which gets called when the target object is about to be reclaimed by the garbage collector. This is useful for objects (targets) that do not have a dedicated life cycle but need some sort of finalization action when no longer used.

targetRef = new WeakRef<Object>(target, new Runnable() {
	public void run() {

To access the target you have to use

object = targetRef.get();
if ( object != null ) {
	// .. do something

The null check is required because the target might have gone away.

Back to the top