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

org.seedstack.netflix.feign.internal.FeignPlugin Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2013-2016, The SeedStack authors 
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.netflix.feign.internal;

import io.nuun.kernel.api.plugin.InitState;
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.api.plugin.request.ClasspathScanRequest;
import org.kametic.specifications.Specification;
import org.seedstack.seed.core.internal.AbstractSeedPlugin;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

public class FeignPlugin extends AbstractSeedPlugin {
    private final Specification> FEIGN_INTERFACE_SPECIFICATION = new FeignInterfaceSpecification();
    private Collection> feignApis = new ArrayList<>();

    @Override
    public String name() {
        return "feign";
    }

    @Override
    public Collection classpathScanRequests() {
        return classpathScanRequestBuilder()
                .specification(FEIGN_INTERFACE_SPECIFICATION)
                .build();
    }

    @Override
    protected InitState initialize(InitContext initContext) {
        Map>> scannedClasses = initContext.scannedTypesBySpecification();
        feignApis.addAll(scannedClasses.get(FEIGN_INTERFACE_SPECIFICATION));
        return InitState.INITIALIZED;
    }

    @Override
    public Object nativeUnitModule() {
        return new FeignModule(feignApis);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy