under construction under construction
Under construction


A result object combines an error code and an error text into a small class.


The default constructor creates a result with a code 0 (=SUCCESS) and an empty text.

public CResult();

There are constructors for taking a code and an optional text:

public CResult(final int aCode);
public CResult(final int aCode,
               final String aText);

The copy constructor creates a copy:

public CResult(@NotNull final CResult aResult);

An exception can be passed directly. The code and the message are then taken from it. In case of a normal JAVA exception, the code is missing, so it is replaced by CResultCode.EXCEPTION.

public CResult(@NotNull final CException aException);
public CResult(@NotNull final Throwable aT);

Adding the text

Adding the result text is analogous to forming a text with a StringBuilder:

public CResult append(final boolean aValue);
public CResult append(final byte aValue);
public CResult append(final char aValue);
public CResult append(final double aValue);
public CResult append(final float aValue);
public CResult append(final int aValue);
public CResult append(final long aValue);
public CResult append(final Object aObj);
public CResult append(final short aValue);
public CResult append(final String aValue);


There are getters for the code and the text.

public int getCode();
public @NotNull String getText();

A combined text with code results in the following method:

public @NotNull String getCombinedText();


Since the object can be changed at any time, there are also setters:

public CResult setCode(final int aCode);
public CResult set(final int aCode,
                   final String aText);

Logging results

Here a result is logged if it is not successful:

public CResult log(@NotNull final ILogger aLogger);


A small static helper method checks if the result is meant successfully. To do this, either the entire result must be null, or the code must be 0.

public static boolean hasSuccess(final CResult aResult);

A non-static method for this also exists:

public boolean isSuccess();

Homepage of nyssr.net and RemoteSkin