use of org.apache.synapse.mediators.annotations.ReadFromMessage in project wso2-synapse by wso2.
the class AnnotatedCommandMediator method introspectClass.
/**
* Introspect the command class annotations
*/
protected void introspectClass(Class<?> commandClass) {
beforeFields = new HashMap<Field, SynapseXPath>();
afterFields = new HashMap<Field, SynapseXPath>();
beforeMethods = new HashMap<Method, SynapseXPath>();
afterMethods = new HashMap<Method, SynapseXPath>();
for (Field f : commandClass.getDeclaredFields()) {
ReadFromMessage readFromMessage = f.getAnnotation(ReadFromMessage.class);
if (readFromMessage != null) {
SynapseXPath axiomXpath = createSynapseXPATH(readFromMessage.value(), f.getAnnotation(Namespaces.class));
beforeFields.put(f, axiomXpath);
}
UpdateMessage updateMessage = f.getAnnotation(UpdateMessage.class);
if (updateMessage != null) {
SynapseXPath axiomXpath = createSynapseXPATH(updateMessage.value(), f.getAnnotation(Namespaces.class));
afterFields.put(f, axiomXpath);
}
ReadAndUpdate readAndUpdate = f.getAnnotation(ReadAndUpdate.class);
if (readAndUpdate != null) {
SynapseXPath axiomXpath = createSynapseXPATH(readAndUpdate.value(), f.getAnnotation(Namespaces.class));
beforeFields.put(f, axiomXpath);
afterFields.put(f, axiomXpath);
}
}
for (Method m : commandClass.getDeclaredMethods()) {
ReadFromMessage readFromMessage = m.getAnnotation(ReadFromMessage.class);
if (readFromMessage != null) {
SynapseXPath axiomXpath = createSynapseXPATH(readFromMessage.value(), m.getAnnotation(Namespaces.class));
beforeMethods.put(m, axiomXpath);
}
UpdateMessage updateMessage = m.getAnnotation(UpdateMessage.class);
if (updateMessage != null) {
SynapseXPath axiomXpath = createSynapseXPATH(updateMessage.value(), m.getAnnotation(Namespaces.class));
afterMethods.put(m, axiomXpath);
}
}
}
Aggregations