1 package org.apache.ldap.server.interceptor; 2 3 4 import java.util.HashMap ; 5 import java.util.Iterator ; 6 import java.util.Map ; 7 8 9 14 15 public class InterceptorConfigBuilder 16 { 17 18 public static Map build( Map map, String prefix ) 19 { 20 Map newMap = new HashMap (); 21 22 Iterator it = map.entrySet().iterator(); 23 24 while ( it.hasNext() ) 25 { 26 Map.Entry e = ( Map.Entry ) it.next(); 27 28 String key = e.getKey().toString(); 29 30 if ( key.startsWith( prefix ) && key.length() > prefix.length() ) 31 { 32 key = key.substring( prefix.length() ); 33 34 if ( key.indexOf( '#' ) < 0 ) 35 { 36 continue; 37 } 38 39 if ( key.charAt( 0 ) == '.' || key.charAt( 0 ) == '#' ) 40 { 41 key = key.substring( 1 ); 42 } 43 44 newMap.put( key, e.getValue() ); 45 } 46 } 47 48 return newMap; 49 } 50 51 52 private InterceptorConfigBuilder() 53 { 54 } 55 } 56 | Popular Tags |