Take the following transformer implementation which already extends BaseTransformer so that it contains less boilerplate code:
public class OrderTransform extends BaseTransformer<Order, OtherOrder> { public OrderTransform() { super(new QName("java:org.foo.Order"), // from new QName("java:org.bar.OtherOrder")); // to } @Override public OtherOrder transform(Order from) { // ... doesn't matter }
Wouldn't it be nicer if it looked like this? We can derive the same configuration based on the declared types for the method.
public class OrderTransform { @Transform public OtherOrder transform(Order from) { // ... doesn't matter }
The prior example was a bit of a cheat because it's just going between java type names. Let's go with an XML -> Java example:
public class OrderTransform { @Transform(to="{urn:examples:feedback:1.0}submitFeedback") public Element transform(Order from) { // ... doesn't matter }
I think the following rules would apply for this annotation:
Thoughts? As usual, Tom was way ahead of me and had a prototype that was close (maybe identical) to what I described above some time ago. Good news is that it should only take him 15 minutes to resolve the JIRA now. :-)
I added a JIRA for this: https://issues.jboss.org/browse/SWITCHYARD-225