public void setPermittedAddresses ( List < DomainMatcher > addrs ) { if ( addrs == null || addrs . isEmpty ( ) ) { ( ( HierarchicalConfiguration ) getConfig ( ) ) . clearTree ( ADDRESS_KEY ) ; this . permittedAddresses = Collections . emptyList ( ) ; this . permittedAddressesEnabled = Collections . emptyList ( ) ; return ; } this . permittedAddresses = new ArrayList <> ( addrs ) ; ( ( HierarchicalConfiguration ) getConfig ( ) ) . clearTree ( ADDRESS_KEY ) ; int size = addrs . size ( ) ; ArrayList < DomainMatcher > enabledAddrs = new ArrayList <> ( size ) ; for ( int i = 0 ; i < size ; ++ i ) { String elementBaseKey = ADDRESS_KEY + "(" + i + ")." ; DomainMatcher addr = addrs . get ( i ) ; getConfig ( ) . setProperty ( elementBaseKey + ADDRESS_VALUE_KEY , addr . getValue ( ) ) ; getConfig ( ) . setProperty ( elementBaseKey + ADDRESS_REGEX_KEY , addr . isRegex ( ) ) ; getConfig ( ) . setProperty ( elementBaseKey + ADDRESS_ENABLED_KEY , addr . isEnabled ( ) ) ; if ( addr . isEnabled ( ) ) { enabledAddrs . add ( addr ) ; } } enabledAddrs . trimToSize ( ) ; this . permittedAddressesEnabled = enabledAddrs ; }
Sets the client addresses that will be allowed to access the API .