Package patterntesting.runtime
Class NullConstants
- java.lang.Object
-
- patterntesting.runtime.NullConstants
-
public final class NullConstants extends java.lang.Object
This class contains some constants (like a NULL_STRING) as constant. It can be statically imported.If you are using Java 8 you can use Optionals to indicate empty (or NULL) values.
- Since:
- 13.06.2009
- Version:
- $Revision: 1.7 $
- Author:
- oliver
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Date
NULL_DATE
You need a null date and don't want to use null?static java.lang.Throwable
NULL_EXCEPTION
You need a null exception and don't want to use null?static java.io.File
NULL_FILE
You need a null file and don't want to use null?static java.lang.Object
NULL_OBJECT
If you have a method with a list of arguments where some arguments are optional you can provide the method with different signatures (good idea, but not always feasible) admit null arguments and handle it in the methode (not a good idea because it can happen accidentally) use this special NULL_OBJECT object to mark an argument as optional Unfortunately this works only for object as argument.static java.lang.String
NULL_STRING
You need a null string and don't want to use null?static java.lang.Throwable
NULL_THROWABLE
You need a null throwable and don't want to use null?static java.net.URI
NULL_URI
You need a null URI and don't want to use null?
-
-
-
Field Detail
-
NULL_OBJECT
public static final java.lang.Object NULL_OBJECT
If you have a method with a list of arguments where some arguments are optional you can- provide the method with different signatures (good idea, but not always feasible)
- admit null arguments and handle it in the methode (not a good idea because it can happen accidentally)
- use this special NULL_OBJECT object to mark an argument as optional
- See Also:
NULL_STRING
-
NULL_STRING
public static final java.lang.String NULL_STRING
You need a null string and don't want to use null? Use NULL_STRING and you can write code likeif (name == NULL_STRING) ...
- See Also:
- Constant Field Values
-
NULL_FILE
public static final java.io.File NULL_FILE
You need a null file and don't want to use null? Use NULL_FILE and you can write code likeif (name == NULL_STRING) ...
-
NULL_THROWABLE
public static final java.lang.Throwable NULL_THROWABLE
You need a null throwable and don't want to use null? Use NULL_THROWABLE and you can write code likeif (name == NULL_THROWABLE) ...
-
NULL_EXCEPTION
public static final java.lang.Throwable NULL_EXCEPTION
You need a null exception and don't want to use null? Use NULL_EXCEPTION and you can write code likeif (name == NULL_EXCEPTION) ...
-
NULL_DATE
public static final java.util.Date NULL_DATE
You need a null date and don't want to use null? Use NULL_DATE and you can write code likeif (name == NULL_DATE) ...
The NULL_DATE is defined here as 1.1.1970 (the epoch).
-
NULL_URI
public static final java.net.URI NULL_URI
You need a null URI and don't want to use null? Uses NULL_URI and you can write code likeif (name == NULL_URI) ...
The NULL_URI is defined as URI for "http://null".
-
-