Enum ExpressionLanguageFeatureLevel
- java.lang.Object
-
- java.lang.Enum<ExpressionLanguageFeatureLevel>
-
- org.hibernate.validator.messageinterpolation.ExpressionLanguageFeatureLevel
-
- All Implemented Interfaces:
Serializable,Comparable<ExpressionLanguageFeatureLevel>
@Incubating public enum ExpressionLanguageFeatureLevel extends Enum<ExpressionLanguageFeatureLevel>
Indicates the level of features enabled for the Expression Language engine.- Since:
- 6.2
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BEAN_METHODSThis level allows what is allowed with thebean-propertieslevel plus bean methods execution and can lead to serious security issues, including arbitrary code execution, if not very carefully handled.BEAN_PROPERTIESOnly allows to what is allowed with thevariableslevel plus access to bean properties.DEFAULTThe default Expression Language feature level.NONEExpression Language expressions are not interpolated.VARIABLESOnly allows access to the variables injected viaHibernateConstraintValidatorContext.addExpressionVariable(String, Object), the Jakarta Bean Validation-definedformatterand theResourceBundles.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ExpressionLanguageFeatureLevelinterpretDefaultForConstraints(ExpressionLanguageFeatureLevel value)static ExpressionLanguageFeatureLevelinterpretDefaultForCustomViolations(ExpressionLanguageFeatureLevel value)static ExpressionLanguageFeatureLevelof(String value)static ExpressionLanguageFeatureLevelvalueOf(String name)Returns the enum constant of this type with the specified name.static ExpressionLanguageFeatureLevel[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DEFAULT
public static final ExpressionLanguageFeatureLevel DEFAULT
The default Expression Language feature level.Depends on the context.
For standard constraint messages, it is
BEAN_PROPERTIES.For custom violations, the default is
NONEand, if Expression Language is enabled for a given custom violation via the API, the default becomesVARIABLESin the context of this given custom violation.
-
NONE
public static final ExpressionLanguageFeatureLevel NONE
Expression Language expressions are not interpolated.
-
VARIABLES
public static final ExpressionLanguageFeatureLevel VARIABLES
Only allows access to the variables injected viaHibernateConstraintValidatorContext.addExpressionVariable(String, Object), the Jakarta Bean Validation-definedformatterand theResourceBundles.
-
BEAN_PROPERTIES
public static final ExpressionLanguageFeatureLevel BEAN_PROPERTIES
Only allows to what is allowed with thevariableslevel plus access to bean properties.This is the minimal level to have a specification-compliant implementation.
-
BEAN_METHODS
public static final ExpressionLanguageFeatureLevel BEAN_METHODS
This level allows what is allowed with thebean-propertieslevel plus bean methods execution and can lead to serious security issues, including arbitrary code execution, if not very carefully handled.If using this level, you need to be sure you are not injecting user input in an expression without properly escaping it using
HibernateConstraintValidatorContext.addExpressionVariable(String, Object).
-
-
Method Detail
-
values
public static ExpressionLanguageFeatureLevel[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ExpressionLanguageFeatureLevel c : ExpressionLanguageFeatureLevel.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ExpressionLanguageFeatureLevel valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
of
public static ExpressionLanguageFeatureLevel of(String value)
-
interpretDefaultForConstraints
public static ExpressionLanguageFeatureLevel interpretDefaultForConstraints(ExpressionLanguageFeatureLevel value)
-
interpretDefaultForCustomViolations
public static ExpressionLanguageFeatureLevel interpretDefaultForCustomViolations(ExpressionLanguageFeatureLevel value)
-
-