Here is one JIRAs :
 
https://issues.jboss.org/browse/ROASTER-16 - Be able to indent code
 
I think I found how to do most of what I wrote on my email.
 
I'm getting code generated from Hibernate Tools and "fixing" it with
Roaster.... really nice ;o)
 
Antonio
 
 
2014-05-28 0:04 GMT+02:00 Lincoln Baxter, III <lincolnbaxter@gmail.com>:
 
Hey Antonio,
 
Sorry for the late reply.
Some of the functionality you ask for is missing, but some of it is there.
I believe we have a property API which will allow you to
getAccessor/Mutator, and also the Refactory should provide the functions
for generating getters/setters. The annotation stuff I think is a gap.
 
Gotta keep it brief, but I hope that helps. Feel free to add JIRA issues
to ROASTER for the missing stuff and we'll try to get it done!
~Lincoln
 
>
 
On Mon, May 26, 2014 at 9:35 AM, Antonio Goncalves <
antonio.mailing@gmail.com> wrote:
 
>> Hi all,
>> 
>> I'm trying to use Roster 2.4.0.Final to manipulate generated Java code at
>> one of my customers. There are features that I miss, and I don't know if
>> it's because it's missing, or I don't know how to do it :
>> 
>> * Remove an attribute in an annotation. Let's say I have @Table(name =
>> "myTable", schema = "mySchema"), I want to be able to remove the schema
>> attribute and end up with @Table(name = "myTable")
>> * Change the value of an attribute in an annotation. Let's say I have
>> @OneToMany (fetch = LAZY) and I want to change LAZY to EAGER. I know how to
>> get this value (ValuePair.getName() and ValuePair.getStringValue()) but I
>> don't know how to set a new value (I was expecting something like
>> ValuePair.setStringValue())
>> * Is there a way to only get the accessors ? At the moment
>> source.getMembers() returns the attributes + getters/setters,
>> source.getFields() only returns the attributes and source.getMethods()
>> returns all the methods. It would be nice to have sources.getAccessors()
>> and that will return only the accesors
>> * Indent code : the code I have in input is not well indented. I would
>> love to have a method like source.indent()
>> * Generate Getters/Setters/Hascode/Equals/toString : it would be great to
>> have a set of methods to do the trick. Something like
>> source.generateSetters, source.generateEquals
>> 
>> Let me know if I'm missing somethings here, if some are out of the scope
>> of Roaster and if some make sense and are missing I'll create a few JIRAs
>> 
>> Antonio
>> 
>> 
>> 2014-04-26 6:28 GMT+02:00 Antonio Goncalves <antonio.mailing@gmail.com>:
>> 
>>  I had created two JIRAs for that :
>>> 
>>> https://issues.jboss.org/browse/ROASTER-4
>>> https://issues.jboss.org/browse/ROASTER-5 (looks like this one is done)
>>> 
>>> 
>>> 2014-04-21 21:22 GMT+02:00 Lincoln Baxter, III <lincolnbaxter@gmail.com>
>>> :
>>> 
>>> Hey Antonio,
>>>> 
>>>> I'm relatively certain that we don't support Generic types on method
>>>> parameters yet, but we do support them on Types and Methods themselves via
>>>> the GenericCapableSource interface.
>>>> 
>>>> Looks like we need to add this to Parameters. Could you add a feature
>>>> request for this? Thanks!
>>>> 
>>>> ~Lincoln
>>>> 
>>>> 
>>>> On Sun, Mar 30, 2014 at 1:05 PM, Antonio Goncalves <
>>>> antonio.mailing@gmail.com> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> Still playing with Roaster so I could fix
>>>>> https://issues.jboss.org/browse/FORGE-1618 (Command
>>>>> constraint-new-validator to create a new validator implementation). I don't
>>>>> know how to do two things (nicely) :
>>>>> 
>>>>> # Parameterize interface
>>>>> 
>>>>> For a constraint, I need to implement a parametrize interface like
>>>>> this :
>>>>> 
>>>>> public class MaxValidatorForString implements ConstraintValidator<Max,
>>>>> Number> {
>>>>> 
>>>>> 
>>>>> The only way I could find is passing a String :
>>>>> 
>>>>> final JavaClassSource javaClass = Roaster.create(JavaClassSource.
>>>>> class);
>>>>> javaClass.setName("MaxValidatorForString");
>>>>> javaClass.addImport(ConstraintValidator.class);
>>>>> javaClass.addInterface("ConstraintValidator<Max, Number>");
>>>>> 
>>>>> It's a shame because with addInterface(Class), it does the import
>>>>> automatically and things are more typed. But I cannot add types :
>>>>> 
>>>>> final JavaClassSource javaClass = Roaster.create(JavaClassSource.
>>>>> class);
>>>>> javaClass.setName("MaxValidatorForString");
>>>>> javaClass.addInterface(ConstraintValidator.class);
>>>>> 
>>>>> It would be good to have something like :
>>>>> 
>>>>> javaClass.addInterface(ConstraintValidator.class).
>>>>> addType(Max.class).addType(Number.class);
>>>>> 
>>>>> # Typed parameters
>>>>> 
>>>>> My isValid method takes two parameters. And the only way to add two
>>>>> parameters seems to be by a String
>>>>> 
>>>>> javaClass.addMethod().setPublic().setName("isValid").setReturnType(
>>>>> "boolean").setParameters("Number value, ConstraintValidatorContext
>>>>> context").setBody("return false;").addAnnotation(Override.class);
>>>>> 
>>>>> Again, it would be nice to have typed parameters so the import is
>>>>> implicit, and things are a bit more typed :
>>>>> 
>>>>> javaClass.addMethod().setPublic().setName("isValid").setReturnType(
>>>>> "boolean").addParameter(Number.class,
>>>>> "value").addParameter(ConstraintValidatorContext.class, "context")
>>>>> .setBody("return false;").addAnnotation(Override.class);
>>>>> 
>>>>> 
>>>>> So I'm just wondering if I'm missing something or this is not
>>>>> implemented yet on Roaster
>>>>> 
>>>>> --
>>>>> Antonio Goncalves
>>>>> Software architect and Java Champion
>>>>> 
>>>>> Web site <http://www.antoniogoncalves.org/> | Twitter<http://twitter.com/agoncal>
>>>>>  | LinkedIn <http://www.linkedin.com/in/agoncal> | Paris JUG<http://www.parisjug.org/>
>>>>>  | Devoxx France <http://www.devoxx.fr/>
>>>>> 
>>>>> _______________________________________________
>>>>> forge-dev mailing list
>>>>> forge-dev@lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Lincoln Baxter, III
>>>> http://ocpsoft.org
>>>> "Simpler is better."
>>>> 
>>>> _______________________________________________
>>>> forge-dev mailing list
>>>> forge-dev@lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Antonio Goncalves
>>> Software architect and Java Champion
>>> 
>>> Web site <http://www.antoniogoncalves.org/> | Twitter<http://twitter.com/agoncal>
>>>  | LinkedIn <http://www.linkedin.com/in/agoncal> | Paris JUG<http://www.parisjug.org/>
>>>  | Devoxx France <http://www.devoxx.fr/>
>>> 
>> 
>> 
>> 
>> --
>> Antonio Goncalves
>> Software architect and Java Champion
>> 
>> Web site <http://www.antoniogoncalves.org/> | Twitter<http://twitter.com/agoncal>
>>  | LinkedIn <http://www.linkedin.com/in/agoncal> | Paris JUG<http://www.parisjug.org/>
>>  | Devoxx France <http://www.devoxx.fr/>
>> 
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>> 
>
>
--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."
 
_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev
 
 
 
 
-- 
Antonio Goncalves
Software architect and Java Champion
 
Web site <http://www.antoniogoncalves.org/> |
Twitter<http://twitter.com/agoncal>
 | LinkedIn <http://www.linkedin.com/in/agoncal> | Paris
JUG<http://www.parisjug.org/>
 | Devoxx France <http://www.devoxx.fr/>