[forge-issues] [JBoss JIRA] (ROASTER-36) property.setType leaves get/set with qualified class name
Antonio Goncalves (JIRA)
issues at jboss.org
Thu Sep 11 15:19:19 EDT 2014
[ https://issues.jboss.org/browse/ROASTER-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001603#comment-13001603 ]
Antonio Goncalves commented on ROASTER-36:
------------------------------------------
Great, I'll give it a try ASAP
> property.setType leaves get/set with qualified class name
> ---------------------------------------------------------
>
> Key: ROASTER-36
> URL: https://issues.jboss.org/browse/ROASTER-36
> Project: Roaster
> Issue Type: Enhancement
> Components: API
> Affects Versions: 2.7.1.Final
> Reporter: Antonio Goncalves
> Assignee: George Gastaldi
> Fix For: 2.7.2.Final
>
> Attachments: roaster.zip
>
>
> I have a use case which is : "Take the attribute of type {{java.util.Date}} and change it to {{org.joda.time.LocalDate}}". Imagine I have the following class :
> {code}
> public class MyClass {
> private Date myFirstDate;
> public Date getMyFirstDate() {
> return myFirstDate;
> }
> public void setMyFirstDate(Date myFirstDate) {
> this.myFirstDate = myFirstDate;
> }
> }
> {code}
> If I only do :
> {code}
> PropertySource<JavaClassSource> property = classToProcess.getProperty("myFirstDate");
> property.setType(LocalDate.class);
> {code}
> This changes both the field and the get/set. But the field gets {{LocalDate}} not qualified, and get/set qualified. This is the final result :
> {code}
> public class MyClass {
> private LocalDate myFirstDate;
> public org.joda.time.LocalDate getMyFirstDate() {
> return myFirstDate;
> }
> public void setMyFirstDate(org.joda.time.LocalDate myFirstDate) {
> this.myFirstDate = myFirstDate;
> }
> }
> {code}
> Only if I do {{property.getAccessor().setReturnType(LocalDate.class)}} I get an unqualified getter. What I would like is to have unqualified class everywhere when I only change the type of the property {{property.setType(LocalDate.class)}} :
> {code}
> public class MyClass {
> private LocalDate myFirstDate;
> public LocalDate getMyFirstDate() {
> return myFirstDate;
> }
> public void setMyFirstDate(LocalDate myFirstDate) {
> this.myFirstDate = myFirstDate;
> }
> }
> {code}
> Attached is a test case
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the forge-issues
mailing list