Interface ObjectResolver
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractObjectResolver
,DirectoryEntryResolver
,DocumentModelResolver
,TestingColorResolver
,UserManagerResolver
External references are document field with a simple type whose value refers to an external business entity. Objects
implementing this interface are able to resolve the entity using the reference.
- Since:
- 7.1
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Manage translation for resolver :ObjectResolver.Helper.getConstraintErrorMessage(ObjectResolver, Object, Locale, String...)
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The validation parameter key to enable/disable validation on resolver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure this resolver.<T> T
Provides the entity referenced by a value, return the entity as expected type.Provides the entity referenced by a value.default Object
Provides the entity referenced by a value, in the given context.getConstraintErrorMessage
(Object invalidValue, Locale locale) Provides an error message to display when some invalid value does not match existing entity.Returns the resolved object types.getName()
Provides this resolver name.Provides this resolver parameters.getReference
(Object object) Generates a reference to an entity.boolean
Validates some value references an existing entity.default boolean
Validates some value references an existing entity, in the given context
-
Field Details
-
VALIDATION_PARAMETER_KEY
The validation parameter key to enable/disable validation on resolver. Enabled by default.- Since:
- 10.2
- See Also:
-
-
Method Details
-
configure
void configure(Map<String, String> parameters) throws IllegalArgumentException, IllegalStateExceptionConfigure this resolver.- Parameters:
parameters
- A map of parameter whose keys are parameter names and map value are corresponding values.- Throws:
IllegalArgumentException
- If some parameter are not compatible with this resolver.IllegalStateException
- If this resolver is already configured.- Since:
- 7.1
-
getManagedClasses
Returns the resolved object types.- Since:
- 7.2
-
getName
String getName()Provides this resolver name.- Returns:
- The resolver name.
- Since:
- 7.1
-
getParameters
Map<String,Serializable> getParameters()Provides this resolver parameters.- Returns:
- A map containing associating parameter name to its value
- Since:
- 7.1
-
validate
Validates some value references an existing entity.- Parameters:
value
- The reference.- Returns:
- true if value could be resolved as an existing external reference, false otherwise.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 7.1
-
validate
Validates some value references an existing entity, in the given context- Parameters:
value
- The reference.context
- A resolver-specific context allowing resolution of the value.- Returns:
- true if value could be resolved as an existing external reference, false otherwise.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 10.2
-
fetch
Provides the entity referenced by a value.- Parameters:
value
- The reference.- Returns:
- The referenced entity, null if no entity matches the value.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 7.1
-
fetch
Provides the entity referenced by a value, in the given context.- Parameters:
value
- The reference.context
- A resolver-specific context allowing resolution of the value.- Returns:
- The referenced entity, null if no entity matches the value.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 10.2
-
fetch
Provides the entity referenced by a value, return the entity as expected type.- Parameters:
value
- The reference.- Returns:
- The referenced entity, null if no entity matches the value or if this entity cannot be converted as type.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 7.1
-
getReference
Generates a reference to an entity.- Parameters:
object
- The entity.- Returns:
- A reference to the entity or null if its not a managed entity type.
- Throws:
IllegalStateException
- If this resolver has not been configured.- Since:
- 7.1
-
getConstraintErrorMessage
Provides an error message to display when some invalid value does not match existing entity.- Parameters:
invalidValue
- The invalid value that don't match any entity.locale
- The language in which the message should be generated.- Returns:
- A message in the specified language or
- Since:
- 7.1
-