colesico.framework.rpc.codegen.generator.EnvelopeExtensionKit Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of colesico-rpc Show documentation
Show all versions of colesico-rpc Show documentation
Colesico framework Remote Procedure Call for Services
The newest version!
package colesico.framework.rpc.codegen.generator;
import colesico.framework.assist.ServiceLocator;
import colesico.framework.rpc.codegen.model.RpcApiMethodElement;
import com.squareup.javapoet.TypeSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
public class EnvelopeExtensionKit {
protected final Logger logger = LoggerFactory.getLogger(EnvelopeExtensionKit.class);
protected final List extensions = new ArrayList<>();
public EnvelopeExtensionKit() {
lookup();
}
public void lookup() {
logger.debug("Lookup envelops extensions...");
extensions.clear();
ServiceLocator locator = ServiceLocator.of(this.getClass(), EnvelopeExtension.class, getClass().getClassLoader());
for (EnvelopeExtension plg : locator.getProviders()) {
extensions.add(plg);
logger.debug("Found envelope extension : " + plg.getClass().getName());
}
}
public List> getRequestExtensions() {
List> result = new ArrayList<>();
for (EnvelopeExtension plugin : extensions) {
result.add(plugin.getRequestExtension());
}
return result;
}
public List> getResponseExtensions() {
List> result = new ArrayList<>();
for (EnvelopeExtension plugin : extensions) {
result.add(plugin.getResponseExtension());
}
return result;
}
}