public interface ObjectResolver extends Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
ObjectResolver.Helper
Manage translation for resolver :
ObjectResolver.Helper.getConstraintErrorMessage(ObjectResolver, Object, Locale, String...) |
Modifier and Type | Field and Description |
---|---|
static String |
VALIDATION_PARAMETER_KEY
The validation parameter key to enable/disable validation on resolver.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Map<String,String> parameters)
Configure this resolver.
|
<T> T |
fetch(Class<T> type,
Object value)
Provides the entity referenced by a value, return the entity as expected type.
|
Object |
fetch(Object value)
Provides the entity referenced by a value.
|
default Object |
fetch(Object value,
Object context)
Provides the entity referenced by a value, in the given context.
|
String |
getConstraintErrorMessage(Object invalidValue,
Locale locale)
Provides an error message to display when some invalid value does not match existing entity.
|
List<Class<?>> |
getManagedClasses()
Returns the resolved object types.
|
String |
getName()
Provides this resolver name.
|
Map<String,Serializable> |
getParameters()
Provides this resolver parameters.
|
Serializable |
getReference(Object object)
Generates a reference to an entity.
|
boolean |
validate(Object value)
Validates some value references an existing entity.
|
default boolean |
validate(Object value,
Object context)
Validates some value references an existing entity, in the given context
|
static final String VALIDATION_PARAMETER_KEY
void configure(Map<String,String> parameters) throws IllegalArgumentException, IllegalStateException
parameters
- A map of parameter whose keys are parameter names and map value are corresponding values.IllegalArgumentException
- If some parameter are not compatible with this resolver.IllegalStateException
- If this resolver is already configured.List<Class<?>> getManagedClasses()
Map<String,Serializable> getParameters()
boolean validate(Object value)
value
- The reference.IllegalStateException
- If this resolver has not been configured.default boolean validate(Object value, Object context)
value
- The reference.context
- A resolver-specific context allowing resolution of the value.IllegalStateException
- If this resolver has not been configured.Object fetch(Object value)
value
- The reference.IllegalStateException
- If this resolver has not been configured.default Object fetch(Object value, Object context)
value
- The reference.context
- A resolver-specific context allowing resolution of the value.IllegalStateException
- If this resolver has not been configured.<T> T fetch(Class<T> type, Object value)
value
- The reference.IllegalStateException
- If this resolver has not been configured.Serializable getReference(Object object)
object
- The entity.IllegalStateException
- If this resolver has not been configured.String getConstraintErrorMessage(Object invalidValue, Locale locale)
invalidValue
- The invalid value that don't match any entity.locale
- The language in which the message should be generated.Copyright © 2019 Nuxeo. All rights reserved.