4
How do I customize the function Generate toString()
eclipse (source > Generate toString()) to print the path of a class?
For example I have the following entity that prints:
package com.etc.model;
@Entity
@Table(name="CLIENTE")
public class Cliente implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="ID")
private int id;
@Override
public String toString() {
return "Cliente [id=" + id + "]";
}
How do I configure generate toString() to exit with the full path? In this case:
@Override
public String toString() {
return "com.etc.model.Cliente [id=" + id + "]";
}
I use the Neon.3 version
Thanks personally for the feedback, but I’ll express myself better. I need to set up Generate Tostring for generate code with full path (what is visualized in package) in the java class.
In the example shown above it generates showing the name of the Client class:
@Override
public String toString() {
return "Cliente [id=" + id + "]";
}
How to customize it to generate code with the full path (the path is shown in the package line):
@Override
public String toString() {
return "com.etc.model.Cliente [id=" + id + "]";
}
See that the full path with the name: with.etc.model.Client It seems that I have to create a new format template, I analyzed it through the documentation but I couldn’t get to what I need.
None of the answers served you? Mine I tested and worked normally.
– user28595
Thanks @Articuno . They helped me.
– FredeBr