public class AccessPath extends Object
As properties can be contained within composites or mixins (or a combination thereof) we may need to
fetch the composite or use Composable.as(Class)
to fetch the mixin in order to access the field. The types
and number of calls are defined by an AccessPath.
Modifier and Type | Field and Description |
---|---|
static AccessPath |
IDENTITY
Represents a NO-OP access path which is used for all fields which are directly contained in the entity.
|
Constructor and Description |
---|
AccessPath() |
Modifier and Type | Method and Description |
---|---|
AccessPath |
append(String prefix,
Function<Object,Object> accessor)
Creates a new access path which appends the given prefix and accessor to the current access path.
|
Object |
apply(Object object)
Applies the access path of the given object.
|
String |
prefix()
Returns the prefix appended to all fields to generate unique property names.
|
public static final AccessPath IDENTITY
@Nonnull public AccessPath append(@Nonnull String prefix, @Nonnull Function<Object,Object> accessor)
prefix
- the prefix to be appended to all field names to make them unique (composites might be
embedded twice).accessor
- the function used to access the sub entity (composite or mixin) from the current access path@Nonnull public Object apply(@Nonnull Object object)
Applies all accessor functions one after another to extract the object containing a property from the given root object.
object
- the root object from which the designated target object (composite or mixin) is to be extractedpublic String prefix()
Copyright © 2018. All rights reserved.