public final class Platform extends Object
Note that this utility class can only be used in a JSF environment and is thus not a Java EE general way to obtain platform services.
Modifier and Type | Field and Description |
---|---|
static String |
BEAN_VALIDATION_AVAILABLE |
Modifier and Type | Method and Description |
---|---|
static Validator |
getBeanValidator()
Returns the bean validator which is aware of the JSF locale.
|
static ValidatorFactory |
getBeanValidatorFactory()
Returns the default bean validator factory.
|
static Collection<String> |
getFacesServletMappings(ServletContext servletContext)
Returns the mappings associated with the
FacesServlet . |
static ServletRegistration |
getFacesServletRegistration(ServletContext servletContext)
Returns the
ServletRegistration associated with the FacesServlet . |
static boolean |
isBeanValidationAvailable()
Returns
true if Bean Validation is available. |
static Map<String,String> |
validateBean(Object bean,
Class<?>... groups)
Validate given bean on given group classes
and return constraint violation messages mapped by property path.
|
static Map<String,String> |
validateBeanProperty(Class<?> beanType,
String propertyName,
Object value,
Class<?>... groups)
Validate given value as if it were a property of the given bean type
and return constraint violation messages mapped by property path.
|
public static final String BEAN_VALIDATION_AVAILABLE
public static boolean isBeanValidationAvailable()
true
if Bean Validation is available. This is remembered in the application scope.true
if Bean Validation is available.public static ValidatorFactory getBeanValidatorFactory()
public static Validator getBeanValidator()
Faces.getLocale()
public static Map<String,String> validateBean(Object bean, Class<?>... groups)
bean
- Bean to be validated.groups
- Bean validation groups, if any.public static Map<String,String> validateBeanProperty(Class<?> beanType, String propertyName, Object value, Class<?>... groups)
beanType
- Type of target bean.propertyName
- Name of property on target bean.value
- Value to be validated.groups
- Bean validation groups, if any.public static ServletRegistration getFacesServletRegistration(ServletContext servletContext)
ServletRegistration
associated with the FacesServlet
.servletContext
- The context to get the ServletRegistration from.null
if the FacesServlet is not installed.public static Collection<String> getFacesServletMappings(ServletContext servletContext)
FacesServlet
.servletContext
- The context to get the FacesServlet
from.FacesServlet
, or an empty set.Copyright © 2012–2020 OmniFaces. All rights reserved.