本文整理匯總了Java中javax.faces.convert.FacesConverter類的典型用法代碼示例。如果您正苦於以下問題:Java FacesConverter類的具體用法?Java FacesConverter怎麽用?Java FacesConverter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FacesConverter類屬於javax.faces.convert包,在下文中一共展示了FacesConverter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: resolveInstanceForClass
import javax.faces.convert.FacesConverter; //導入依賴的package包/類
@Override
protected Converter resolveInstanceForClass(FacesContext facesContext, Class<?> wrappedClass)
{
FacesConverter facesConverter = wrappedClass.getAnnotation(FacesConverter.class);
if (facesConverter == null)
{
return null;
}
if (!"".equals(facesConverter.value()))
{
return facesContext.getApplication().createConverter(facesConverter.value());
}
return facesContext.getApplication().createConverter(facesConverter.forClass());
}
示例2: testAnnotatedClasses
import javax.faces.convert.FacesConverter; //導入依賴的package包/類
@Test
public void testAnnotatedClasses() throws MalformedURLException, IOException {
Map<Class<? extends Annotation>, Set<Class<?>>> annotatedClasses = new HashMap<>();
annotatedClasses.put(FacesConverter.class, new HashSet<>());
JoinFacesAnnotationProvider.setAnnotatedClasses(annotatedClasses);
assertThat(new JoinFacesAnnotationProvider().getAnnotatedClasses(null).get(FacesConverter.class))
.isNotNull();
}