@Override
    @SuppressWarnings({"unchecked", "rawtypes"})
    public @NonNull CommandFlag<?> assembleFlag(final @NonNull FlagDescriptor descriptor) {
        final Description description;
        if (descriptor.description() == null) {
            description = Description.empty();
        } else {
            description = descriptor.description();
        }

        final Permission permission;
        if (descriptor.permission() == null) {
            permission = Permission.empty();
        } else {
            permission = descriptor.permission();
        }

        CommandFlag.Builder<?, Void> builder = this.commandManager
                .flagBuilder(descriptor.name())
                .withDescription(description)
                .withAliases(descriptor.aliases())
                .withPermission(permission);
        if (descriptor.repeatable()) {
            builder = builder.asRepeatable();
        }

        if (descriptor.parameter().getType().equals(boolean.class)) {
            return builder.build();
        }

        final TypeToken<?> token;
        if (descriptor.repeatable() && Collection.class.isAssignableFrom(descriptor.parameter().getType())) {
            token = TypeToken.get(GenericTypeReflector.getTypeParameter(
                    descriptor.parameter().getParameterizedType(),
                    Collection.class.getTypeParameters()[0]
            ));
        } else {
            token = TypeToken.get(descriptor.parameter().getType());
        }

        if (token.equals(TypeToken.get(boolean.class))) {
            return builder.build();
        }

        final Collection<Annotation> annotations = Arrays.asList(descriptor.parameter().getAnnotations());
        final ParserRegistry<?> registry = this.commandManager.parserRegistry();
        final ArgumentParser<?, ?> parser;
        if (descriptor.parserName() == null) {
            parser = registry.createParser(token, registry.parseAnnotations(token, annotations))
                    .orElse(null);
        } else {
            parser = registry.createParser(descriptor.parserName(), registry.parseAnnotations(token, annotations))
                    .orElse(null);
        }
        if (parser == null) {
            throw new IllegalArgumentException(
                    String.format(
                            "Cannot find parser for type '%s' for flag '%s'",
                            descriptor.parameter().getType().getCanonicalName(),
                            descriptor.name()
                    ));
        }
        final SuggestionProvider<?> suggestionProvider;
        if (descriptor.suggestions() != null) {
            suggestionProvider = registry.getSuggestionProvider(descriptor.suggestions()).orElse(null);
        } else {
            suggestionProvider = null;
        }
        final CommandComponent.Builder componentBuilder = CommandComponent.builder();
        componentBuilder.commandManager(this.commandManager)
                .name(descriptor.name())
                .valueType(descriptor.parameter().getType())
                .parser(parser);
        if (suggestionProvider != null) {
            componentBuilder.suggestionProvider(suggestionProvider);
        }
        return builder.withComponent(componentBuilder.build()).build();
    }
Creates a new flag assembler.

@param commandManager command manager
cloud-annotations/src/main/java/org/incendo/cloud/annotations/assembler/FlagAssemblerImpl.java