public abstract class HostPatternsHolder extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ALL_HOSTS_PATTERN |
static char |
NEGATION_CHAR_PATTERN
Used to negate a host pattern
|
static char |
NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM
Non-standard port specification host pattern enclosure end delimiter
|
static char |
NON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM
Non-standard port specification host pattern enclosure start delimiter
|
static String |
PATTERN_CHARS
The available pattern characters
|
static char |
PORT_VALUE_DELIMITER
Port value separator if non-standard port pattern used
|
static char |
SINGLE_CHAR_PATTERN
Used in a host pattern to denote any one character
|
static char |
WILDCARD_PATTERN
Used in a host pattern to denote zero or more consecutive characters
|
| Modifier | Constructor and Description |
|---|---|
protected |
HostPatternsHolder() |
| Modifier and Type | Method and Description |
|---|---|
static List<HostConfigEntry> |
findMatchingEntries(String host,
Collection<? extends HostConfigEntry> entries)
Locates all the matching entries for a give host name / address
|
static List<HostConfigEntry> |
findMatchingEntries(String host,
HostConfigEntry... entries)
Locates all the matching entries for a give host name / address
|
Collection<HostPatternValue> |
getPatterns() |
boolean |
isHostMatch(String host,
int port)
Checks if a given host name / address matches the entry's host pattern(s)
|
static boolean |
isHostMatch(String host,
int port,
Collection<HostPatternValue> patterns) |
static boolean |
isHostMatch(String host,
Pattern pattern)
Checks if a given host name / address matches a host pattern
|
static boolean |
isPortMatch(int port1,
int port2) |
static boolean |
isSpecificHostPattern(String pattern) |
static boolean |
isValidPatternChar(char ch)
Checks if the given character is valid for a host pattern.
|
static List<HostPatternValue> |
parsePatterns(CharSequence... patterns) |
static List<HostPatternValue> |
parsePatterns(Collection<? extends CharSequence> patterns) |
void |
setPatterns(Collection<HostPatternValue> patterns) |
static HostPatternValue |
toPattern(CharSequence patternString)
Converts a host pattern string to a regular expression matcher.
|
public static final char WILDCARD_PATTERN
public static final String ALL_HOSTS_PATTERN
public static final char SINGLE_CHAR_PATTERN
public static final char NEGATION_CHAR_PATTERN
public static final String PATTERN_CHARS
public static final char PORT_VALUE_DELIMITER
public static final char NON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM
public static final char NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM
public Collection<HostPatternValue> getPatterns()
public void setPatterns(Collection<HostPatternValue> patterns)
public boolean isHostMatch(String host, int port)
host - The host name / address - ignored if null/emptyport - The connection porttrue if the name / address matches the pattern(s)isHostMatch(String, Pattern)public static boolean isSpecificHostPattern(String pattern)
pattern - The pattern to check - ignored if null/emptytrue if the pattern is not empty and contains no wildcard charactersWILDCARD_PATTERN,
SINGLE_CHAR_PATTERN,
SINGLE_CHAR_PATTERNpublic static List<HostConfigEntry> findMatchingEntries(String host, HostConfigEntry... entries)
host - The host name / address - ignored if null/emptyentries - The HostConfigEntry-ies to scan - ignored if null/emptyList of all the matching entriesisHostMatch(String, int)public static List<HostConfigEntry> findMatchingEntries(String host, Collection<? extends HostConfigEntry> entries)
host - The host name / address - ignored if null/emptyentries - The HostConfigEntry-ies to scan - ignored if null/emptyList of all the matching entriesisHostMatch(String, int)public static boolean isHostMatch(String host, int port, Collection<HostPatternValue> patterns)
public static boolean isPortMatch(int port1,
int port2)
port1 - 1st port value - if non-positive the assumed to be DEFAULT_PORTport2 - 2nd port value - if non-positive the assumed to be DEFAULT_PORTtrue if ports are effectively equalpublic static boolean isHostMatch(String host, Pattern pattern)
host - The host name / address - ignored if null/emptypattern - The host Pattern - ignored if nulltrue if the name / address matches the patternpublic static List<HostPatternValue> parsePatterns(CharSequence... patterns)
public static List<HostPatternValue> parsePatterns(Collection<? extends CharSequence> patterns)
public static HostPatternValue toPattern(CharSequence patternString)
patternString - The original pattern string - ignored if null/emptyPattern and the indication whether it is a negating
pattern or not - null if no original stringNON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM,
NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM,
WILDCARD_PATTERN,
SINGLE_CHAR_PATTERN,
NEGATION_CHAR_PATTERNpublic static boolean isValidPatternChar(char ch)
WILDCARD_PATTERNSINGLE_CHAR_PATTERNch - The character to validatetrue if valid pattern characterCopyright © 2018–2021 The Apache Software Foundation. All rights reserved.