com.hltech.pact.gen.domain.client.annotation.MappingHandlerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pact-gen Show documentation
Show all versions of pact-gen Show documentation
Automated generation of pact files
The newest version!
package com.hltech.pact.gen.domain.client.annotation;
import com.google.common.collect.Lists;
import com.hltech.pact.gen.domain.client.annotation.handlers.AnnotatedMethodHandler;
import lombok.RequiredArgsConstructor;
import org.reflections.Reflections;
import java.util.List;
@RequiredArgsConstructor
public class MappingHandlerFactory {
private static final String PACKAGE = "com.hltech.pact.gen";
private final HandlersFactory handlersFactory;
public List createAll() {
try {
return handlersFactory.createHandlers(findClasses());
} catch (IllegalAccessException | InstantiationException exception) {
throw new MappingMethodCreationException("Cannot create mapping handler", exception);
}
}
private List> findClasses() {
return Lists.newArrayList(new Reflections(PACKAGE).getTypesAnnotatedWith(MappingMethodHandler.class));
}
}