Class EntityAwareFieldResolver
java.lang.Object
in.co.akshitbansal.springwebquery.resolver.field.EntityAwareFieldResolver
- All Implemented Interfaces:
FieldResolver
FieldResolver implementation that resolves selectors directly
against an entity model, with optional alias support via FieldMapping.
This resolver can rewrite request selectors using declared aliases, reject access to original field names when a mapping forbids them, and validate the resolved terminal entity field via the supplied callback.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityAwareFieldResolver(@NonNull Class<?> entityClass, @NonNull List<FieldMapping> fieldMappings) Creates an entity-aware resolver from raw field-mapping declarations. -
Method Summary
Modifier and TypeMethodDescriptionresolvePathAndValidateTerminalField(@NonNull String reqFieldPath, @Nullable Consumer<Field> terminalFieldValidator) Resolves an entity-facing selector path, validates the resolved terminal field, and returns the final entity path.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface in.co.akshitbansal.springwebquery.resolver.field.FieldResolver
resolvePath
-
Constructor Details
-
EntityAwareFieldResolver
protected EntityAwareFieldResolver(@NonNull @NonNull Class<?> entityClass, @NonNull @NonNull List<FieldMapping> fieldMappings) Creates an entity-aware resolver from raw field-mapping declarations.The supplied mappings are normalized into immutable lookup maps keyed by alias name and original entity field path so callers do not need to precompute resolver-specific structures.
- Parameters:
entityClass- entity type used for path resolutionfieldMappings- declared alias mappings from the public API contract
-
-
Method Details
-
resolvePathAndValidateTerminalField
public String resolvePathAndValidateTerminalField(@NonNull @NonNull String reqFieldPath, @Nullable Consumer<Field> terminalFieldValidator) Resolves an entity-facing selector path, validates the resolved terminal field, and returns the final entity path.- Specified by:
resolvePathAndValidateTerminalFieldin interfaceFieldResolver- Parameters:
reqFieldPath- selector path from the incoming requestterminalFieldValidator- callback used to validate the resolved terminal field; whennull, terminal-field validation is skipped- Returns:
- resolved entity path after alias translation
- Throws:
QueryFieldValidationException- if the request path is blocked by mapping rules or cannot be resolved against the entity type
-