net.sf.mmm.util.pojo.path.api
Enum PojoPathMode

java.lang.Object
  extended by java.lang.Enum<PojoPathMode>
      extended by net.sf.mmm.util.pojo.path.api.PojoPathMode
All Implemented Interfaces:
Serializable, Comparable<PojoPathMode>

public enum PojoPathMode
extends Enum<PojoPathMode>

This Enum contains the available modes for using a PojoPathNavigator. The PojoPathMode has influence on how the PojoPathNavigator deals with (intermediate) null values.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Enum Constant Summary
CREATE_IF_NULL
          This mode causes the PojoPathNavigator to create Pojos if they are null.
FAIL_IF_NULL
          This mode causes the PojoPathNavigator to fail with an PojoPathSegmentIsNullException if an intermediate Pojo is null.
RETURN_IF_NULL
          This mode causes the PojoPathNavigator to return null if an intermediate Pojo is null.
 
Method Summary
static PojoPathMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static PojoPathMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CREATE_IF_NULL

public static final PojoPathMode CREATE_IF_NULL
This mode causes the PojoPathNavigator to create Pojos if they are null. This applies to intermediate Pojos as well as the final result of the PojoPath.
The creation in case of «Property» or «Index» will happen via the PojoFactory provided by the PojoPathContext.


FAIL_IF_NULL

public static final PojoPathMode FAIL_IF_NULL
This mode causes the PojoPathNavigator to fail with an PojoPathSegmentIsNullException if an intermediate Pojo is null. However if only the last segment of the PojoPath evaluates to null, then null is returned. If an «Index» is greater or equal to the size of the ordered container,a NlsIndexOutOfBoundsException is thrown.


RETURN_IF_NULL

public static final PojoPathMode RETURN_IF_NULL
This mode causes the PojoPathNavigator to return null if an intermediate Pojo is null. This also applies for ordered containers if «Index» is greater or equal to the containers size.

Method Detail

values

public static PojoPathMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (PojoPathMode c : PojoPathMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static PojoPathMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


Copyright © 2001-2010 mmm-Team. All Rights Reserved.