[Cucumber-JVM] Overriding/Extending default String Transformer for ALL step transforms

384 views
Skip to first unread message

Tim Mertens

unread,
Jan 21, 2013, 6:07:42 PM1/21/13
to cu...@googlegroups.com
I would like to override/extend the default Transformer used for ALL transformations.  I am already doing this manually using a custom transformer class. For example:

@Then("^I can transform vars in steps \"([^\"]*)\"$")
public static void I_can_transform_vars_in_steps(@Transform(StringVarTransformer.class) String text) {

//My step definition
}

The StringVarTransformer class looks at the String variable to see if it contains any references to stored data objects I am storing in a static data registry, and it extracts data from the referenced field in those objects using reflection.  This all works fine using the @Transform() annotation, but I must specify it for every transformation in my step definitions.

Ideally, this would happen seamlessly for every transformation without using the @Transformation notation, and the transformation would occur before any Transformer defined using the @Transformer notation, if for some reason I need to use an additional Transformer using the notation.

Is there an easy way to provide a global transform class that extends the default behavior?  I can work around it if it is not possible but I thought I would ask.


Steve Messina

unread,
Aug 2, 2013, 4:31:23 AM8/2/13
to cu...@googlegroups.com
Hi Tim

This is of interest to me too - did you get anywhere with this?

Regards
Steve

aslak hellesoy

unread,
Aug 3, 2013, 5:41:59 PM8/3/13
to Cucumber Users
No, there is not.

If you have an idea how you'd like things to work, please share an example and we can discuss from there whether it's something we'd be interested in adding.

Thanks,
Aslak 
 
I can work around it if it is not possible but I thought I would ask.



--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
 
 

Tim M

unread,
Aug 3, 2013, 6:59:29 PM8/3/13
to cu...@googlegroups.com


On Aug 2, 2013 8:14 AM, "Steve Messina" <steve.g...@gmail.com> wrote:
>
> Hi Tim
>
> This is of interest to me too - did you get anywhere with this?
>

No. I have simply used the normal notation for using a custom transformer where needed.

> --
> -- Rules --
>  
> 1) Please prefix the subject with [Ruby], [JVM] or [JS].
> 2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
> 3) If you have a question, don't reply to an existing message. Start a new topic instead.
>  
> You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en

> ---
> You received this message because you are subscribed to a topic in the Google Groups "Cukes" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/cukes/IYZBxzZ9ADk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to cukes+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

Reply all
Reply to author
Forward
0 new messages