Hi there,
2013/12/31 <[email protected]>
> Lukas,
>
> So finally I use my own Maven plugin and it works well.
>
> But for the camel cased setters and getters, it seems the only format that
> I'm not able to generate is the one I want!!
>
> I try to apply the format to all fields, using :
> *fields.setExpression("^(.+)$");*
>
> For "*passwordEncrypted*", I want the generated getter to be "
> *getPasswordEncrypted()*".
>
> This doesn't work because the first letter is not uppercased :
>
> matcherRuleGetter.setExpression("get$1");
>> matcherRuleGetter.setTransform(MatcherTransformType.AS_IS);
>>
>
> Results in "*getpasswordEncrypted()*".
>
> I also tried :
>
> matcherRuleGetter.setExpression("get_$1");
>> matcherRuleGetter.setTransform(MatcherTransformType.CAMEL);
>>
>
> Results in "*getPasswordencrypted()*".
>
> And :
>
> matcherRuleGetter.setExpression("get_$1");
>> matcherRuleGetter.setTransform(MatcherTransformType.PASCAL);
>>
>
> Results in "*GetPasswordencrypted()*".
>
Thanks for the detailed listing. Yes, you're right, none of the transform
types will work for your use-case, as MatcherTransformType is applied only
after regex replacement.
> Sadly I *think *(not sure) that it's not possible to specify, in a Java's
> regular expressions replacement string, that we want to convert a character
> to uppercase.
>
I don't think you can do this, either. This is nicely explained in this
Stack Overflow question here:
http://stackoverflow.com/a/2770977/521799
> I hope the format I'm looking for is possible to generate since, in my
> opinion, it's the one that makes the more sense when dealing with pojos,
> don't you think? It would follow the beans' getters and setters
> specification.
>
Yes it would make more sense. I guess, this could be resolved with an
additional MatcherTransformType? We would need one that is similar to CAMEL
/ PASCAL casing (removing underscores, uppercasing subsequent letters) but
would keep casing within words AS_IS.
What would be an appropriate name for such a transformation scheme?
I have registered #2924 for this. Should be easy to fix:
https://github.com/jOOQ/jOOQ/issues/2924
> I'll simply use a custom GeneratorStrategy, it's not that bad! :-)
OK :-)
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.