@ Nonnull public PathMatchingResult matchesParts ( @ Nonnull final List < String > aPathParts ) { ValueEnforcer . notNull ( aPathParts , "PathParts" ) ; final int nPartCount = m_aPathParts . size ( ) ; if ( aPathParts . size ( ) != nPartCount ) { // Size must match return PathMatchingResult . NO_MATCH ; } final ICommonsOrderedMap < String , String > aVariableValues = new CommonsLinkedHashMap <> ( ) ; for ( int i = 0 ; i < nPartCount ; ++ i ) { final PathDescriptorPart aPart = m_aPathParts . get ( i ) ; final String sPathPart = aPathParts . get ( i ) ; if ( ! aPart . matches ( sPathPart ) ) { // Current part does not match - full error return PathMatchingResult . NO_MATCH ; } // Matching variable part? if ( aPart . isVariable ( ) ) aVariableValues . put ( aPart . getName ( ) , sPathPart ) ; } // We've got it! return PathMatchingResult . createSuccess ( aVariableValues ) ; }
Check if this path descriptor matches the provided path parts . This requires that this path descriptor and the provided collection have the same number of elements and that all static and variable parts match .