Class Getter
- java.lang.Object
-
- com.remondis.propertypath.api.Getter
-
public final class Getter extends java.lang.ObjectThis is the Property Path API that can be used to build null-safe getters evaluating a specific property path.This library can be used to build get-chains easier. If you have a lot of optional fields in a large Java Bean object graph you normally have to implement null checks whenever accessing an optional field. This library performs this null checks so a property path can be written like
a.getB().getC(). The return value of getB() does not have to be checked fornull.A property path is a chain of get-calls. If a getter returns
This is the entry point of the builder API.nullthe property path does not have a value. The same is true for lists and maps that are eithernullor do not contain a specified index or key. The null-checks are performed by the library an must not be implemented in the property path.Important information
Once the builder creates a
Getinstance, this instance can and should be reused. This library creates proxy classes which is a time consuming operation that is only neccessary once. So cache theGetinstance as long as possible.
-
-
Constructor Summary
Constructors Constructor Description Getter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <I,O>
GetBuilder<I>newFor(java.lang.Class<I> startType)Creates a builder of a property path for the specified type.
-
-
-
Method Detail
-
newFor
public static <I,O> GetBuilder<I> newFor(java.lang.Class<I> startType)
Creates a builder of a property path for the specified type.- Parameters:
startType- The type to evaluate a property path on.- Returns:
- Returns a builder for further configuration.
-
-