All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hltech.pact.gen.domain.client.annotation.MappingHandlerFactory Maven / Gradle / Ivy

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));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy