use of io.atlasmap.api.AtlasFieldAction in project atlasmap by atlasmap.
the class DefaultAtlasFieldActionService method loadFieldActions.
protected void loadFieldActions() {
ClassLoader classLoader = this.getClass().getClassLoader();
final ServiceLoader<AtlasFieldAction> fieldActionServiceLoader = ServiceLoader.load(AtlasFieldAction.class, classLoader);
for (final AtlasFieldAction atlasFieldAction : fieldActionServiceLoader) {
if (LOG.isDebugEnabled()) {
LOG.debug("Loading FieldAction class: " + atlasFieldAction.getClass().getCanonicalName());
}
Class<?> clazz = atlasFieldAction.getClass();
Method[] methods = clazz.getMethods();
for (Method method : methods) {
AtlasFieldActionInfo annotation = method.getAnnotation(AtlasFieldActionInfo.class);
if (annotation != null) {
ActionDetail det = new ActionDetail();
det.setClassName(clazz.getName());
det.setMethod(method.getName());
det.setName(annotation.name());
det.setSourceType(annotation.sourceType());
det.setTargetType(annotation.targetType());
det.setSourceCollectionType(annotation.sourceCollectionType());
det.setTargetCollectionType(annotation.targetCollectionType());
try {
det.setParameters(detectFieldActionParameters("io.atlasmap.v2." + annotation.name()));
} catch (ClassNotFoundException e) {
LOG.error(String.format("Error detecting parameters for field action=%s msg=%s", annotation.name(), e.getMessage()), e);
}
if (LOG.isTraceEnabled()) {
LOG.trace("Loaded FieldAction: " + det.getName());
}
listActionDetails().add(det);
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Loaded %s Field Actions", listActionDetails().size()));
}
}
Aggregations