com.manywho.sdk.services.actions.ActionRepository Maven / Gradle / Ivy
package com.manywho.sdk.services.actions;
import org.reflections.Reflections;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.lang.reflect.Field;
import java.util.Set;
@Singleton
public class ActionRepository {
private final Reflections reflections;
private Set> actions;
private Set> actionCommands;
private Set inputFields;
private Set outputFields;
@Inject
public ActionRepository(Reflections reflections) {
this.reflections = reflections;
}
public Set> getActions() {
if (actions == null) {
actions = reflections.getTypesAnnotatedWith(Action.Metadata.class);
}
return actions;
}
public Set> getActionCommands() {
if (actionCommands == null) {
actionCommands = reflections.getSubTypesOf(ActionCommand.class);
}
return actionCommands;
}
public Set getInputFields() {
if (inputFields == null) {
inputFields = reflections.getFieldsAnnotatedWith(Action.Input.class);
}
return inputFields;
}
public Set getOutputFields() {
if (outputFields == null) {
outputFields = reflections.getFieldsAnnotatedWith(Action.Output.class);
}
return outputFields;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy