class PropertyBasedUserProviderMapper implements UserProviderMapper
{
    protected final Map<String, UserProvider> providersByPrefix = new HashMap<>();

    protected UserProvider fallbackProvider;

    public PropertyBasedUserProviderMapper()
    {
        // Migrate properties.
        JiveGlobals.migratePropertyTree( "propertyBasedUserMapper" );

        // Instantiate the fallback provider
        fallbackProvider = UserMultiProvider.instantiate( "propertyBasedUserMapper.fallbackProvider.className" );
        if ( fallbackProvider == null )
        {
            throw new IllegalStateException( "Expected a UserProvider class name in property 'propertyBasedUserMapper.fallbackProvider.className'" );
        }
        // Instantiate all sets
        final List<String> setProperties = JiveGlobals.getPropertyNames( "propertyBasedUserMapper.set" );
        for ( final String setProperty : setProperties )
        {
            final UserProvider provider = UserMultiProvider.instantiate( setProperty + ".provider.className" );
            if ( provider == null )
            {
                throw new IllegalStateException( "Expected a UserProvider class name in property '" + setProperty + ".provider.className'" );
            }

            providersByPrefix.put( setProperty, provider );
        }
    }

    @Override
    public UserProvider getUserProvider( String username )
    {<FILL_FUNCTION_BODY>}

    @Override
    public Set<UserProvider> getUserProviders()
    {
        final Set<UserProvider> result = new LinkedHashSet<>();
        result.addAll( providersByPrefix.values() );
        result.add( fallbackProvider );

        return result;
    }
}

        for ( final Map.Entry<String, UserProvider> entry : providersByPrefix.entrySet() )
        {
            final String usersProperty = JiveGlobals.getProperty( entry.getKey() + ".members.propertyName" );
            if ( usersProperty != null )
            {
                final List<String> usersInSet = JiveGlobals.getListProperty( usersProperty, Collections.<String>emptyList() );
                if ( usersInSet.contains( username ) )
                {
                    return entry.getValue();
                }
            }
        }

        return fallbackProvider;
    
<no_super_class>