protected List lookup()

in commons-digester3-core/src/main/java/org/apache/commons/digester3/RulesBase.java [89:112]


    protected List<Rule> lookup( final String namespaceURI, final String pattern )
    {
        // Optimize when no namespace URI is specified
        final List<Rule> list = this.cache.get( pattern );
        if ( list == null )
        {
            return null;
        }
        if ( namespaceURI == null || namespaceURI.isEmpty() )
        {
            return list;
        }

        // Select only Rules that match on the specified namespace URI
        final List<Rule> results = new ArrayList<>();
        for ( final Rule item : list )
        {
            if ( namespaceURI.equals( item.getNamespaceURI() ) || item.getNamespaceURI() == null )
            {
                results.add( item );
            }
        }
        return results;
    }