public static class LookupSession.LookupSessionBuilder
extends java.lang.Object
LookupSession
instances. An instance of this class is obtained by calling
LookupSession.builder()
and configured using the methods with names corresponding to
the different properties. Once fully configured, a LookupSession
instance is obtained
by calling build()
on the builder instance.Modifier and Type | Field and Description |
---|---|
private java.util.List<Cache> |
caches |
private boolean |
cycleResults |
private java.util.concurrent.Executor |
executor |
private HostsFileParser |
hostsFileParser |
private IrrelevantRecordMode |
irrelevantRecordMode |
private int |
maxRedirects |
private int |
ndots |
private Resolver |
resolver |
private java.util.List<Name> |
searchPath |
Modifier | Constructor and Description |
---|---|
private |
LookupSessionBuilder() |
Modifier and Type | Method and Description |
---|---|
LookupSession |
build()
Create an instance of
LookupSession configured by this builder. |
LookupSession.LookupSessionBuilder |
cache(@NonNull Cache cache)
Enable caching using the supplied cache.
|
LookupSession.LookupSessionBuilder |
cache(@NonNull java.lang.Integer dclass,
@NonNull Cache cache)
Deprecated.
use
cache(Cache) , the Cache already provides the class. |
LookupSession.LookupSessionBuilder |
caches(@NonNull java.util.Collection<Cache> caches)
Enable caching using the supplied caches.
|
LookupSession.LookupSessionBuilder |
caches(@NonNull java.util.Map<java.lang.Integer,Cache> caches)
Deprecated.
use
cache(Cache) or caches(Collection) , the Cache
already provides the class. |
LookupSession.LookupSessionBuilder |
clearCaches()
Disables using a cache for lookups.
|
LookupSession.LookupSessionBuilder |
clearSearchPath()
Removes all search paths.
|
LookupSession.LookupSessionBuilder |
cycleResults(boolean cycleResults)
If set to
true , cached results with multiple records will be returned with the
starting point shifted one step per request. |
LookupSession.LookupSessionBuilder |
defaultHostsFileParser()
Enable querying the local hosts database using the system defaults.
|
LookupSession.LookupSessionBuilder |
executor(java.util.concurrent.Executor executor)
The executor to use when running lookups.
|
LookupSession.LookupSessionBuilder |
hostsFileParser(HostsFileParser hostsFileParser)
Configures the local hosts database file parser to use within this session.
|
(package private) LookupSession.LookupSessionBuilder |
irrelevantRecordMode(IrrelevantRecordMode irrelevantRecordMode)
Sets how irrelevant records in a
Message returned from the resolver(Resolver) is handled. |
LookupSession.LookupSessionBuilder |
maxRedirects(int maxRedirects)
The maximum number of CNAME or DNAME redirects allowed before lookups will fail with
RedirectOverflowException . |
LookupSession.LookupSessionBuilder |
ndots(int ndots)
The threshold for the number of dots which must appear in a name before it is considered
absolute.
|
LookupSession.LookupSessionBuilder |
resolver(@NonNull Resolver resolver)
The
Resolver to use to look up records. |
LookupSession.LookupSessionBuilder |
searchPath(java.util.Collection<? extends Name> searchPath)
Configures the search path used to look up relative names with less than ndots dots.
|
LookupSession.LookupSessionBuilder |
searchPath(Name searchPath)
Configures the search path used to look up relative names with less than ndots dots.
|
private Resolver resolver
private int maxRedirects
private int ndots
private java.util.List<Name> searchPath
private boolean cycleResults
private java.util.List<Cache> caches
private HostsFileParser hostsFileParser
private java.util.concurrent.Executor executor
private IrrelevantRecordMode irrelevantRecordMode
public LookupSession.LookupSessionBuilder resolver(@NonNull @NonNull Resolver resolver)
Resolver
to use to look up records.this
.public LookupSession.LookupSessionBuilder maxRedirects(int maxRedirects)
RedirectOverflowException
. Defaults to 16.this
.public LookupSession.LookupSessionBuilder ndots(int ndots)
this
.public LookupSession.LookupSessionBuilder searchPath(Name searchPath)
this
.public LookupSession.LookupSessionBuilder searchPath(java.util.Collection<? extends Name> searchPath)
this
.public LookupSession.LookupSessionBuilder clearSearchPath()
this
.public LookupSession.LookupSessionBuilder cycleResults(boolean cycleResults)
true
, cached results with multiple records will be returned with the
starting point shifted one step per request.this
.public LookupSession.LookupSessionBuilder hostsFileParser(HostsFileParser hostsFileParser)
this
.public LookupSession.LookupSessionBuilder executor(java.util.concurrent.Executor executor)
this
.LookupSession.LookupSessionBuilder irrelevantRecordMode(IrrelevantRecordMode irrelevantRecordMode)
Message
returned from the resolver(Resolver)
is handled. The default is IrrelevantRecordMode.REMOVE
.this
.public LookupSession.LookupSessionBuilder defaultHostsFileParser()
this
.HostsFileParser
public LookupSession.LookupSessionBuilder cache(@NonNull @NonNull Cache cache)
Cache
for the same class will be
replaced.this
.Cache
public LookupSession.LookupSessionBuilder caches(@NonNull @NonNull java.util.Collection<Cache> caches)
Cache
s for the same class will be
replaced.this
.Cache
public LookupSession.LookupSessionBuilder clearCaches()
this
.@Deprecated public LookupSession.LookupSessionBuilder cache(@NonNull @NonNull java.lang.Integer dclass, @NonNull @NonNull Cache cache)
cache(Cache)
, the Cache
already provides the class.dclass
- unusedthis
.Cache
@Deprecated public LookupSession.LookupSessionBuilder caches(@NonNull @NonNull java.util.Map<java.lang.Integer,Cache> caches)
cache(Cache)
or caches(Collection)
, the Cache
already provides the class.caches
- unusedthis
.Cache
public LookupSession build()
LookupSession
configured by this builder.