org.specrunner.expressions.core
Class NullEmptyHandlerDefault

java.lang.Object
  extended by org.specrunner.expressions.core.NullEmptyHandlerDefault
All Implemented Interfaces:
INullEmptyHandler

public class NullEmptyHandlerDefault
extends Object
implements INullEmptyHandler

Default implementation. On output verification empty TDs are considered null. In other words, for these TDs the verification against database check if database columns hold null.

Author:
Thiago Santos

Field Summary
static String EMPTY
          Default empty String markup.
protected  String emptyVal
          The empty string mark.
protected static ThreadLocal<INullEmptyHandler> instance
          Thread safe instance.
static String NULL
          Default empty String markup.
protected  String nullVal
          The empty string mark.
 
Constructor Summary
NullEmptyHandlerDefault()
           
 
Method Summary
 String emptyValue(EMode mode)
          Empty value for a given mode.
static INullEmptyHandler get()
          Singleton method.
 String getEmptyVal()
          Return the empty constant.
 String getNullVal()
          Get null explicit representation.
 boolean isEmpty(EMode mode, String value)
          Check if a value should be handled as empty, depending on value and mode.
 boolean isNull(EMode mode, String value)
          Check if a value should be handled as null, depending on value and mode.
 String nullValue(EMode mode)
          Null value for a given mode.
 void setEmptyVal(String empty)
          Set empty mark.
 void setNullVal(String nullval)
          Set null explicit representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static ThreadLocal<INullEmptyHandler> instance
Thread safe instance.


NULL

public static final String NULL
Default empty String markup.

See Also:
Constant Field Values

nullVal

protected String nullVal
The empty string mark.


EMPTY

public static final String EMPTY
Default empty String markup.

See Also:
Constant Field Values

emptyVal

protected String emptyVal
The empty string mark.

Constructor Detail

NullEmptyHandlerDefault

public NullEmptyHandlerDefault()
Method Detail

get

public static INullEmptyHandler get()
Singleton method.

Returns:
A null/empty handler.

getNullVal

public String getNullVal()
Get null explicit representation.

Returns:
Null representation.

setNullVal

public void setNullVal(String nullval)
Set null explicit representation.

Parameters:
nullval - Null representation.

getEmptyVal

public String getEmptyVal()
Return the empty constant.

Returns:
The flag.

setEmptyVal

public void setEmptyVal(String empty)
Set empty mark.

Parameters:
empty - Empty mark.

nullValue

public String nullValue(EMode mode)
Description copied from interface: INullEmptyHandler
Null value for a given mode.

Specified by:
nullValue in interface INullEmptyHandler
Parameters:
mode - A mode.
Returns:
Explicit null representation.

emptyValue

public String emptyValue(EMode mode)
Description copied from interface: INullEmptyHandler
Empty value for a given mode.

Specified by:
emptyValue in interface INullEmptyHandler
Parameters:
mode - A mode.
Returns:
Explicit empty representation.

isNull

public boolean isNull(EMode mode,
                      String value)
Description copied from interface: INullEmptyHandler
Check if a value should be handled as null, depending on value and mode.

Specified by:
isNull in interface INullEmptyHandler
Parameters:
mode - A mode.
value - A value.
Returns:
true, if should be considered null, false, otherwise.

isEmpty

public boolean isEmpty(EMode mode,
                       String value)
Description copied from interface: INullEmptyHandler
Check if a value should be handled as empty, depending on value and mode.

Specified by:
isEmpty in interface INullEmptyHandler
Parameters:
mode - A mode.
value - A value.
Returns:
true, if should be considered empty, false, otherwise.


Copyright © 2015. All rights reserved.