Search in sources :

Example 1 with FactoryFinder

use of jakarta.faces.FactoryFinder in project myfaces by apache.

the class FactoryFinderTest method getRegisteredFactoryNames.

/*
     * This method allows us access to the _registeredFactoryNames field so we can test the content of that map during
     * the running of this test.
     * 
     * @return Returns the _registeredFactoryNames Map from the FactoryFinder class. @throws NoSuchFieldException
     * 
     * @throws IllegalAccessException
     */
@SuppressWarnings("unchecked")
private Map<ClassLoader, Map<String, List<String>>> getRegisteredFactoryNames() throws IllegalAccessException {
    Class<FactoryFinder> factoryFinderClass = FactoryFinder.class;
    Field[] fields = factoryFinderClass.getDeclaredFields();
    Field field = null;
    for (int i = 0; i < fields.length; i++) {
        if (fields[i].getName().equals("registeredFactoryNames")) {
            field = fields[i];
            field.setAccessible(true);
            break;
        }
    }
    Map<ClassLoader, Map<String, List<String>>> _registeredFactoryNames = (Map<ClassLoader, Map<String, List<String>>>) field.get(null);
    return _registeredFactoryNames;
}
Also used : Field(java.lang.reflect.Field) List(java.util.List) Map(java.util.Map) FactoryFinder(jakarta.faces.FactoryFinder)

Aggregations

FactoryFinder (jakarta.faces.FactoryFinder)1 Field (java.lang.reflect.Field)1 List (java.util.List)1 Map (java.util.Map)1