How to control indentation of Annotation members
Closed this issue · 6 comments
developerworks commented
I generate code like this, but i have not find the way to control the indentation of annotation members
import java.lang.Long;
import java.lang.String;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Generated by javapeot
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(
name = "user"
)
public class User {
@Id
@GeneratedValue(
strategy = GenerationType.IDENTITY
)
@Column(
name = "id"
)
private Long id;
@Column(
name = "name"
)
private String name;
@Column(
name = "created_at"
)
private Timestamp createdAt;
}
I want this:
@GeneratedValue(
strategy = GenerationType.IDENTITY
)
to be
@GeneratedValue(strategy = GenerationType.IDENTITY)
developerworks commented
This is the annotation creation method:
private AnnotationSpec createJpaColumnAnnotation(String columnName) {
return AnnotationSpec.builder(ClassName.get("javax.persistence", "Column"))
.addMember("name", "$S", columnName)
.build();
}
swankjesse commented
We don't have APIs to customize indentation. But if there's a change we should make to the defaults please send a pull request!
topalavlad commented
I think the compact type of annotations is usually preferred. Would you guys be OK with changing the default to that?
JakeWharton commented
No because then you just create the opposite problem.
…On Sat, Oct 20, 2018, 4:34 AM Vlad Topala ***@***.*** wrote:
I think the compact type of annotations is usually preferred. Would you
guys be OK with changing the default to that?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#658 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEQW8rfWjbLX1bKDb3COuJtFAx9Jpks5umuAngaJpZM4VlrNE>
.
topalavlad commented
Then this issue can be closed or is there a plan to add APIs to customize indentation?
JakeWharton commented
No. A better solution would be to write the annotation, see if it exceeds
the column limit, and then rewrite it with a property on each line.
…On Sat, Oct 20, 2018, 11:36 AM Vlad Topala ***@***.*** wrote:
Then this issue can be closed or is there a plan to add *APIs to
customize indentation*?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#658 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEUVkYSVlJd5PLyQhElQ0SoPWhT-aks5um0MSgaJpZM4VlrNE>
.