Interface ResourceResolver<T>
- Type Parameters:
T- the domain type for this resolver
Application-provided adapter that materialises a
ResourceRef into a domain object and exposes the attributes
a policy might want to reason about (owner id, status, …).
Each resolver covers a single resource type.
The application registers all its resolvers with a
ResourceResolverRegistry at startup — typically inside a
VaadinServiceInitListener or equivalent bootstrap hook —
after which ResourcePredicates can consult the registry
from inside a policy evaluation.
-
Method Summary
Modifier and TypeMethodDescriptionattributes(T resource) Extracts the predicate-relevant attributes of a resolved resource (e.g.Loads the domain object for the given resource id, or returns empty if no such resource exists.Stable, non-blank resource type identifier (e.g.
-
Method Details
-
resourceType
String resourceType()Stable, non-blank resource type identifier (e.g."document"). Must match theResourceRef.resourceType()of every reference this resolver should handle.- Returns:
- resource type
-
resolve
Loads the domain object for the given resource id, or returns empty if no such resource exists. Resolvers should not throw for unknown ids — returnOptional.empty()so policies can deny gracefully.- Parameters:
id- resource id; nevernullor blank- Returns:
- domain object, or empty
-
attributes
Extracts the predicate-relevant attributes of a resolved resource (e.g.ownerId,status). The returned map is read-only — callers must not mutate it. Implementations should include only fields that are safe to expose to policy code.- Parameters:
resource- non-nullresolved domain object- Returns:
- read-only attribute map
-