Class VirtualCommandFactory
java.lang.Object
net.apartium.cocoabeans.commands.virtual.VirtualCommandFactory
Used to construct instances of
VirtualCommandDefinition- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataMapper(BiConsumer<AnnotatedElement, Map<String, Object>> mapper) Enrich all virtual commands created through this factory with metadata by adding it in the mapper parameter
Example of usage:create(CommandNode... nodes) Map a command node into a virtual commandgetMetadata(Method method) getMetadata(Collection<Class<?>> classes) protected voidgetVariants(Method method, Set<VirtualCommandVariant> variants) protected Set<VirtualCommandVariant> getVariants(Collection<Class<?>> classes) protected voidmetaDataMap(AnnotatedElement element, Map<String, Object> metadata)
-
Constructor Details
-
VirtualCommandFactory
public VirtualCommandFactory()
-
-
Method Details
-
addMetadataMapper
Enrich all virtual commands created through this factory with metadata by adding it in the mapper parameter
Example of usage:VirtualCommandFactory factory = ...; factory.addMetadataMapper((element, metadata) -> { Permission permission = element.getAnnotation(Permission.class); if (permission != null) metadata.put("permission", permission.value()); });- Parameters:
mapper- mapping annotated element into metadata
-
create
Map a command node into a virtual command- Parameters:
nodes- command nodes to represent- Returns:
- a new virtual command instance
-
metaDataMap
-
getMetadata
-
getMetadata
-
getVariants
-
getVariants
-