Search in sources :

Example 1 with AnnotationCommandSegmentFactory

use of io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory in project lettuce-core by lettuce-io.

the class ReactiveCommandSegmentCommandFactoryUnitTests method createCommand.

RedisCommand<?, ?, ?> createCommand(String methodName, Class<?> interfaceClass, Class<?>... parameterTypes) {
    Method method = ReflectionUtils.findMethod(interfaceClass, methodName, parameterTypes);
    CommandMethod commandMethod = DeclaredCommandMethod.create(method);
    AnnotationCommandSegmentFactory segmentFactory = new AnnotationCommandSegmentFactory();
    CommandSegments commandSegments = segmentFactory.createCommandSegments(commandMethod);
    ReactiveCommandSegmentCommandFactory factory = new ReactiveCommandSegmentCommandFactory(commandSegments, commandMethod, new StringCodec(), outputFactoryResolver);
    return factory.createCommand(new Object[] { "foo" });
}
Also used : AnnotationCommandSegmentFactory(io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory) StringCodec(io.lettuce.core.codec.StringCodec) CommandSegments(io.lettuce.core.dynamic.segment.CommandSegments) Method(java.lang.reflect.Method)

Example 2 with AnnotationCommandSegmentFactory

use of io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory in project lettuce-core by lettuce-io.

the class CommandSegmentCommandFactoryUnitTests method createCommand.

@SuppressWarnings("unchecked")
private RedisCommand<?, ?, ?> createCommand(CommandMethod commandMethod, RedisCodec<?, ?> codec, Object... args) {
    CommandSegmentFactory segmentFactory = new AnnotationCommandSegmentFactory();
    CodecAwareOutputFactoryResolver outputFactoryResolver = new CodecAwareOutputFactoryResolver(new OutputRegistryCommandOutputFactoryResolver(new OutputRegistry()), codec);
    CommandSegmentCommandFactory factory = new CommandSegmentCommandFactory(segmentFactory.createCommandSegments(commandMethod), commandMethod, codec, outputFactoryResolver);
    return factory.createCommand(args);
}
Also used : AnnotationCommandSegmentFactory(io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory) OutputRegistryCommandOutputFactoryResolver(io.lettuce.core.dynamic.output.OutputRegistryCommandOutputFactoryResolver) OutputRegistry(io.lettuce.core.dynamic.output.OutputRegistry) CommandSegmentFactory(io.lettuce.core.dynamic.segment.CommandSegmentFactory) AnnotationCommandSegmentFactory(io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory) CodecAwareOutputFactoryResolver(io.lettuce.core.dynamic.output.CodecAwareOutputFactoryResolver)

Example 3 with AnnotationCommandSegmentFactory

use of io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory in project lettuce-core by lettuce-io.

the class DefaultCommandMethodVerifierUnitTests method validateMethod.

private void validateMethod(String methodName, Class<?>... parameterTypes) {
    Method method = ReflectionUtils.findMethod(MyInterface.class, methodName, parameterTypes);
    CommandSegmentFactory commandSegmentFactory = new AnnotationCommandSegmentFactory();
    CommandMethod commandMethod = DeclaredCommandMethod.create(method);
    CommandSegments commandSegments = commandSegmentFactory.createCommandSegments(commandMethod);
    sut.validate(commandSegments, commandMethod);
}
Also used : AnnotationCommandSegmentFactory(io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory) CommandSegments(io.lettuce.core.dynamic.segment.CommandSegments) Method(java.lang.reflect.Method) CommandSegmentFactory(io.lettuce.core.dynamic.segment.CommandSegmentFactory) AnnotationCommandSegmentFactory(io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory)

Aggregations

AnnotationCommandSegmentFactory (io.lettuce.core.dynamic.segment.AnnotationCommandSegmentFactory)3 CommandSegmentFactory (io.lettuce.core.dynamic.segment.CommandSegmentFactory)2 CommandSegments (io.lettuce.core.dynamic.segment.CommandSegments)2 Method (java.lang.reflect.Method)2 StringCodec (io.lettuce.core.codec.StringCodec)1 CodecAwareOutputFactoryResolver (io.lettuce.core.dynamic.output.CodecAwareOutputFactoryResolver)1 OutputRegistry (io.lettuce.core.dynamic.output.OutputRegistry)1 OutputRegistryCommandOutputFactoryResolver (io.lettuce.core.dynamic.output.OutputRegistryCommandOutputFactoryResolver)1