Interface Property<T>
- All Known Implementing Classes:
Property.Enumeration, Property.Map, Property.Singleton
public sealed interface Property<T>
permits Property.Enumeration<E>, Property.Singleton<T>, Property.Map<K,V>
Properties
An Property represent either...
- a config option to adjust the behaviour of JDA-Commands (like
JDACBuilder.shutdownJDA(boolean)) - an implementation of exposed services (like
Localizer) - or a service provided by the framework that are exposed to the user (like
I18n)
Although the user can provide custom values for these properties, the properties itself are all defined by the JDA-Commands and exposed as public static fields in this interface.
Categories
Properties are primarily categorized by 3 groups:
- user settable -> only configurable by using the designated
JDACBuildermethod - user settable + loadable from extension -> above applies plus values can be provided by
Extensions - provided -> service that are provided by JDA-Commands, the user can use but not create/replace them
Types
Additionally, there are 3 types of properties:
Property.Singleton-> the property will have the value of the provider with the highest priorityProperty.Map-> the property represents a Map with a key and value. The value of all providers will be accumulated and providers with higher priorities take precedenceProperty.Enumeration-> the property represents aCollection. The value of all providers will be accumulated
The only exception to this general accumulation rule are fallback values. Whether they are accumulated with other
providers or overwritten is defined by fallbackBehaviour().
Stages
A Property's value is only set during some stages during the frameworks runtime and in the process of execution
user interactions.
To know in what stage a property's value is accessible take a look at the fields IntrospectionAccess annotation
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe category of a property defines how values for it can be provided.static final recordAProperty.Enumerationproperty basically represents aCollectionof multiple values.static enumThe fallback behaviour defines whether the fallback value provided by JDA-Commands should be accumulated together with the user defined ones or overwritten.static final recordAProperty.Mapproperty basically represents aMap, where each value belongs target a specific key.static final recordAProperty.Singletonproperty just hols one value. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Property<Collection<ClassFinder>> static final Property<Definitions> TheDefinitionsinstance available after fully starting the framework.static final Property<Descriptor> static final Property<Consumer<EmbedConfig>> static final Property<Collection<EmbedDataSource>> static final Property<EmojiResolver> TheEmojiResolverservice provided by JDA-Commands.static final Property<Collection<EmojiSource>> static final Property<ErrorMessageFactory> static final Property<ExpirationStrategy> static final Property<Map<Class<? extends Extension.Data>, Extension.Data>> static final Property<ExtensionFilter> static final Property<CommandDefinition.CommandConfig> static final Property<InteractionDefinition.ReplyConfig> static final Property<GuildScopeProvider> TheI18nservice provided by JDA-Commands.static final Property<InteractionControllerInstantiator> static final Property<Introspection> TheIntrospectioninstance itself used to retrieve properties in this scope.static final Property<InvocationContext<?>> TheInvocationContextof this interaction.TheJDAinstance bound to this specific Runtime.static final Property<JDACommands> TheJDACommandsinstance available after fully starting the framework.static final Property<GenericInteractionCreateEvent> TheGenericInteractionCreateEventof this interaction.static final Property<KeyValueStore> TheKeyValueStoreassociated with this runtime.static final Collection<Property<?>> A collection consisting of allPropertys that are settable by the user and loadable through extensionsstatic final Property<LocalizationFunction> TheLocalizationFunctionbacked byMessageResolverused to localize/resolve commands and descriptions.static final Property<ClassFinder> static final Property<MessageResolver> TheMessageResolverservice provided byt JDA-Commands.static final Property<Collection<Map.Entry<Priority, Middleware>>> MIDDLEWARE property holds multipleMiddlewares associated with theirPrioritystatic final Property<Collection<String>> static final Property<PermissionsProvider> static final Property<PlaceholderResolver> ThePlaceholderResolverservice provided by JDA-Commands.static final Collection<Property<?>> A collection consisting of allPropertys that are provided by JDA-CommandsThe identifier bound to this runtime.static final Property<Collection<Resolver<String>>> static final Property<Map<AdapterType<?, ?>, TypeAdapter<?, ?>>> The TYPE_ADAPTER property mapsAdapterTypes containing the source and targetsTypes to their associatedTypeAdapterstatic final Collection<Property<?>> A collection consisting of allPropertys that are settable by the userstatic final Property<Map<Class<? extends Annotation>, Validator<?, ?>>> The VALIDATOR property maps aValidatorto its identifying annotation. -
Method Summary
Modifier and TypeMethodDescriptioncategory()The category of the property defines the way a value for it can be provided.Whether the fallback values provided by JDA-Commands should be accumulated together with other user providedPropertyProviders for this property.name()The name of the property is a user and machine-readable unique identifier for a propertystage()The stage or "level" at which this property has a value set.
-
Field Details
-
CLASS_FINDER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=OVERRIDE) static final Property<Collection<ClassFinder>> CLASS_FINDER- See Also:
-
EMOJI_SOURCES
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=OVERRIDE) static final Property<Collection<EmojiSource>> EMOJI_SOURCES- See Also:
-
EMBED_SOURCES
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=ACCUMULATE) static final Property<Collection<EmbedDataSource>> EMBED_SOURCES- See Also:
-
DESCRIPTOR
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<Descriptor> DESCRIPTOR- See Also:
-
LOCALIZER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<Localizer> LOCALIZER- See Also:
-
INTERACTION_CONTROLLER_INSTANTIATOR
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<InteractionControllerInstantiator> INTERACTION_CONTROLLER_INSTANTIATOR- See Also:
-
MIDDLEWARE
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=ACCUMULATE) static final Property<Collection<Map.Entry<Priority, Middleware>>> MIDDLEWAREMIDDLEWARE property holds multipleMiddlewares associated with theirPriority- See Also:
-
TYPE_ADAPTER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=ACCUMULATE) static final Property<Map<AdapterType<?,?>, TypeAdapter<?, TYPE_ADAPTER?>>> The TYPE_ADAPTER property mapsAdapterTypes containing the source and targetsTypes to their associatedTypeAdapter- See Also:
-
VALIDATOR
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=ACCUMULATE) static final Property<Map<Class<? extends Annotation>, Validator<?,?>>> VALIDATORThe VALIDATOR property maps aValidatorto its identifying annotation.- See Also:
-
PERMISSION_PROVIDER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<PermissionsProvider> PERMISSION_PROVIDER- See Also:
-
ERROR_MESSAGE_FACTORY
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<ErrorMessageFactory> ERROR_MESSAGE_FACTORY- See Also:
-
GUILD_SCOPE_PROVIDER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE) static final Property<GuildScopeProvider> GUILD_SCOPE_PROVIDER- See Also:
-
STRING_RESOLVER
@PropertyInformation(stage=CONFIGURATION, category=LOADABLE, fallbackBehaviour=ACCUMULATE) static final Property<Collection<Resolver<String>>> STRING_RESOLVER- See Also:
-
GLOBAL_COMMAND_CONFIG
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<CommandDefinition.CommandConfig> GLOBAL_COMMAND_CONFIG- See Also:
-
GLOBAL_REPLY_CONFIG
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<InteractionDefinition.ReplyConfig> GLOBAL_REPLY_CONFIG- See Also:
-
PACKAGES
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE, fallbackBehaviour=ACCUMULATE) static final Property<Collection<String>> PACKAGES- See Also:
-
EXPIRATION_STRATEGY
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<ExpirationStrategy> EXPIRATION_STRATEGY- See Also:
-
LOCALIZE_COMMANDS
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<Boolean> LOCALIZE_COMMANDS- See Also:
-
SHUTDOWN_JDA
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<Boolean> SHUTDOWN_JDA- See Also:
-
EXTENSION_DATA
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE, fallbackBehaviour=ACCUMULATE) static final Property<Map<Class<? extends Extension.Data>, Extension.Data>> EXTENSION_DATA- See Also:
-
EXTENSION_FILTER
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<ExtensionFilter> EXTENSION_FILTER- See Also:
-
EMBED_CONFIG
@PropertyInformation(stage=CONFIGURATION, category=USER_SETTABLE) static final Property<Consumer<EmbedConfig>> EMBED_CONFIG- See Also:
-
INTROSPECTION
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<Introspection> INTROSPECTIONTheIntrospectioninstance itself used to retrieve properties in this scope. Can also be used to retrieve the usedIntrospectioninstance viaPropertyProvider.Context.get(Property). (which will have stage =Stage.CONFIGURATION) -
I18N
- Implementation Note:
- the
PropertyProviderfor this value is defined in the constructor ofJDACBuilder
-
LOCALIZATION_FUNCTION
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<LocalizationFunction> LOCALIZATION_FUNCTIONTheLocalizationFunctionbacked byMessageResolverused to localize/resolve commands and descriptions.- See Also:
-
MESSAGE_RESOLVER
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<MessageResolver> MESSAGE_RESOLVER- Implementation Note:
- the
PropertyProviderfor this value is defined in the constructor ofJDACBuilder
-
EMOJI_RESOLVER
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<EmojiResolver> EMOJI_RESOLVERTheEmojiResolverservice provided by JDA-Commands. Needs the value ofEMOJI_RESOLVER.- Implementation Note:
- the
PropertyProviderfor this value is defined in the constructor ofJDACBuilder
-
PLACEHOLDER_RESOLVER
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<PlaceholderResolver> PLACEHOLDER_RESOLVERThePlaceholderResolverservice provided by JDA-Commands.- Implementation Note:
- the
PropertyProviderfor this value is defined in the constructor ofJDACBuilder
-
MERGED_CLASS_FINDER
@PropertyInformation(stage=CONFIGURATION, category=PROVIDED) static final Property<ClassFinder> MERGED_CLASS_FINDERAnClassFinderinstance that is backed by allClassFinderofCLASS_FINDER. It will search in all registeredClassFinderfor the requested class.- Implementation Note:
- the
PropertyProviderfor this value is defined in the constructor ofJDACBuilder
-
JDA_COMMANDS
@PropertyInformation(stage=INITIALIZED, category=PROVIDED) static final Property<JDACommands> JDA_COMMANDSTheJDACommandsinstance available after fully starting the framework. -
DEFINITIONS
@PropertyInformation(stage=INITIALIZED, category=PROVIDED) static final Property<Definitions> DEFINITIONSTheDefinitionsinstance available after fully starting the framework. -
JDA
-
RUNTIME_ID
The identifier bound to this runtime. Same asEvent.runtimeId(). -
KEY_VALUE_STORE
@PropertyInformation(stage=RUNTIME, category=PROVIDED) static final Property<KeyValueStore> KEY_VALUE_STORETheKeyValueStoreassociated with this runtime. Same asInvocationContext.keyValueStore()orEvent.kv(). -
JDA_EVENT
@PropertyInformation(stage=PREPARATION, category=PROVIDED) static final Property<GenericInteractionCreateEvent> JDA_EVENTTheGenericInteractionCreateEventof this interaction. Same asEvent.jdaEvent(). -
INVOCATION_CONTEXT
@PropertyInformation(stage=INTERACTION, category=PROVIDED) static final Property<InvocationContext<?>> INVOCATION_CONTEXTTheInvocationContextof this interaction. Same as inMiddleware.accept(InvocationContext). -
LOADABLE
A collection consisting of allPropertys that are settable by the user and loadable through extensions- See Also:
-
USER_SETTABLE
A collection consisting of allPropertys that are settable by the user- See Also:
-
PROVIDED
A collection consisting of allPropertys that are provided by JDA-Commands- See Also:
-
-
Method Details
-
fallbackBehaviour
Property.FallbackBehaviour fallbackBehaviour()Whether the fallback values provided by JDA-Commands should be accumulated together with other user providedPropertyProviders for this property.- Returns:
- the fallback behaviour
-
name
String name()The name of the property is a user and machine-readable unique identifier for a property- Returns:
- the name of the property
-
category
Property.Category category()The category of the property defines the way a value for it can be provided.- Returns:
- the category of the property
-
stage
Stage stage()The stage or "level" at which this property has a value set.
-