Wednesday, 4 September 2013

Throwing own errors debug infos

Short description:
First argument is just an example (this Object reference)
Most of this code is quite understandable.
We are using error string message from resource by its string id.

private void checkNotNull(Object reference, String name) {
        if (reference == null) {
            throw new NullPointerException(
                    getString(R.string.error_config, name));
        }
    }