com.atlassian.ip
Class IPMatcher.Builder

java.lang.Object
  extended by com.atlassian.ip.IPMatcher.Builder
Enclosing class:
IPMatcher

public static class IPMatcher.Builder
extends java.lang.Object

A builder for creating immutable IPMatcher instances. Builder instances can be reused; it is safe to call build() multiple times.


Method Summary
 IPMatcher.Builder addPattern(java.lang.String pattern)
          Adds a new pattern to be matched against.
 IPMatcher.Builder addPatternOrHost(java.lang.String patternOrHost)
          Adds a new pattern or host to be matched against.
 IPMatcher.Builder addSubnet(Subnet subnet)
          Adds a new subnet to be matched against.
 IPMatcher build()
          Return a newly-created IPMatcher based on the contents of the Builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addPatternOrHost

public IPMatcher.Builder addPatternOrHost(java.lang.String patternOrHost)
Adds a new pattern or host to be matched against. DNS lookup is performed for hosts in order to get related IP addresses. Patterns can be IPv4/IPv6 addresses, subnets in both asterisk and CIDR notation, or hostnames. The following patterns are valid ip addresses or subnets:
 192.168.1.10
 ::10
 192.168.1.*
 192.168.5.128/26
 0:0:0:7b::/64
 
If a pattern is not a valid ip address or subnet, it will be treated as a hostname.

Parameters:
patternOrHost - pattern to be matched against
Throws:
java.lang.IllegalArgumentException - if the pattern is null or empty

addPattern

public IPMatcher.Builder addPattern(java.lang.String pattern)
Adds a new pattern to be matched against. Patterns can be IPv4/IPv6 addresses or subnets in both asterisk and CIDR notation. Examples of valid patterns:
 192.168.1.10
 ::10
 192.168.1.*
 192.168.5.128/26
 0:0:0:7b::/64
 

Parameters:
pattern - pattern to be matched against
Throws:
java.lang.IllegalArgumentException - if the pattern is null or empty

addSubnet

public IPMatcher.Builder addSubnet(Subnet subnet)
Adds a new subnet to be matched against.

Parameters:
subnet - non-null subnet to be matched against

build

public IPMatcher build()
Return a newly-created IPMatcher based on the contents of the Builder.

Returns:


Copyright © 2012 Atlassian. All Rights Reserved.