T - The underlying type of the option valuepublic final class Option<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Option.CacheEntry |
| Modifier and Type | Method and Description |
|---|---|
T |
attr(io.netty.channel.Channel channel)
A convenient method for retrieving a channel's attribute associated with this option
|
T |
attr(io.netty.channel.ChannelHandlerContext context)
A convenient method for retrieving a channel's attribute associated with this option
|
void |
attr(io.netty.channel.ChannelHandlerContext context,
T value)
A convenient method for modifying a channel's attribute
|
void |
attr(io.netty.channel.Channel channel,
T value)
A convenient method for modifying a channel's attribute
|
static void |
consolidate(Options options,
Class<?> source) |
static <V> Option<V> |
create(String key)
Creates a singleton instance of an
Option based on the key provided |
static <V> Option<V> |
create(String key,
V defaultValue)
Creates a singleton instance of an
Option based on the key provided |
static <V> Option<V> |
create(String key,
V defaultValue,
boolean channelAttribute)
Creates a singleton instance of an
Option based on the key provided |
static <V> Option<V> |
create(String key,
V defaultValue,
boolean channelAttribute,
boolean autoCreate)
Creates a singleton instance of an
Option based on the key provided. |
boolean |
equals(Object o) |
Class<? extends Options> |
getDeclaringClass()
|
T |
getDefaultValue()
Getter for the field
defaultValue. |
String |
getFieldName()
Getter for the field
fieldName. |
static <V> V |
getGlobal(Option<V> option)
Retrieve a global
Option declared from GeneralOptions container |
static <V> V |
getGlobal(Option<V> option,
V defaultValue)
Retrieve a global
Option declared from GeneralOptions container |
UUID |
getId() |
String |
getKey()
Getter for the field
key. |
static com.google.common.collect.SetMultimap<Class<? extends Options>,Option.CacheEntry> |
getOptions()
Returns a read-only
SetMultimap containing of all the Options provided by this library |
int |
hashCode() |
static void |
initialize(Class<? extends Options> containerClass) |
boolean |
isAutoCreate()
isAutoCreate.
|
boolean |
isChannelAttribute()
isChannelAttribute.
|
boolean |
isGlobal()
isGlobal.
|
boolean |
isShared() |
static <V> Option<V> |
of(Class<? extends Options> containerClass,
Class<?> context,
Option<?> option) |
static <V> Option<V> |
of(Class<? extends Options> containerClass,
Class<?> context,
String key) |
static <V> Option<V> |
of(Class<? extends Options> containerClass,
String key)
Retrieve an singleton
Option instance using the provided class group and key combination |
static <V> Option<V> |
of(String key)
Retrieve a singleton instance of an
Option using the provided key. |
static <V> Option<V> |
ofGlobal(String key)
Returns a singleton
Option instance from global |
io.netty.util.AttributeKey<T> |
toAttributeKey()
toAttributeKey.
|
String |
toString() |
@ApiStatus.Internal public static void initialize(Class<? extends Options> containerClass)
public static <V> Option<V> of(String key)
Retrieve a singleton instance of an Option using the provided key.
Note: This will lookup the GeneralOptions container by default
V - a V classkey - The key to be used for the lookupOption associated with the keypublic String getKey()
Getter for the field key.
Optionpublic static <V> Option<V> of(Class<? extends Options> containerClass, Class<?> context, Option<?> option)
public static <V> Option<V> of(Class<? extends Options> containerClass, Class<?> context, String key)
public static <V> Option<V> ofGlobal(String key)
Returns a singleton Option instance from global
public boolean isGlobal()
isGlobal.
true if this option is a Global option typeGeneralOptionspublic static <V> V getGlobal(Option<V> option)
Option declared from GeneralOptions containerV - The captured return typeoption - The Option to be used as lookupOption retrieved from the GeneralOptions containerpublic static <V> V getGlobal(Option<V> option, V defaultValue)
Option declared from GeneralOptions containerV - The captured return typeoption - The Option to be used as lookupdefaultValue - The default value to return if the initial return value is nullOption retrieved from the GeneralOptions containerpublic static <V> Option<V> create(String key)
Option based on the key providedpublic static <V> Option<V> create(String key, V defaultValue)
Option based on the key providedpublic static <V> Option<V> create(String key, V defaultValue, boolean channelAttribute)
Option based on the key providedV - The underlying type of the Optionkey - The unique key of the optiondefaultValue - The default value for this OptionchannelAttribute - true if this option should be added as a default channel attributeOption instance based on the key provided.public static <V> Option<V> create(String key, V defaultValue, boolean channelAttribute, boolean autoCreate)
Option based on the key provided. NOTE: The newly created instance will not be added to the cache.V - The underlying type of the Optionkey - The unique key of the optiondefaultValue - The default value for this OptionchannelAttribute - true if this option should be added as a default channel attributeautoCreate - If true, the channel attribute will be automatically initialized in the underlying Channel regardless whether or not it is explicitly set by the client. This is only applicable when channelAttribute is set to true.Option instance based on the key provided.public static <V> Option<V> of(Class<? extends Options> containerClass, String key)
Retrieve an singleton Option instance using the provided class group and key combination
public static com.google.common.collect.SetMultimap<Class<? extends Options>,Option.CacheEntry> getOptions()
SetMultimap containing of all the Options provided by this libraryImmutableSetMultimappublic boolean isShared()
public T getDefaultValue()
Getter for the field defaultValue.
Optionpublic boolean isChannelAttribute()
isChannelAttribute.
true if this option is also a channel attributepublic boolean isAutoCreate()
isAutoCreate.
true if autoCreate flag is set.public io.netty.util.AttributeKey<T> toAttributeKey()
toAttributeKey.
AttributeKey instance of this optionpublic void attr(io.netty.channel.ChannelHandlerContext context,
T value)
context - The ChannelHandlerContext whose Channel will be updatedvalue - The value to be modifiedpublic void attr(io.netty.channel.Channel channel,
T value)
channel - The Channel that will be updatedvalue - The value to be modifiedpublic T attr(io.netty.channel.ChannelHandlerContext context)
context - The ChannelHandlerContext whos Channel will be queried using the attribute associated with this option.public T attr(io.netty.channel.Channel channel)
channel - The Channel that will be queried using the attribute associated with this option.public UUID getId()
Copyright © 2016–2024. All rights reserved.