-1

Is there a way to automatically (or with a one-click trigger to) remove all annotations from a class source code in whichever IDE?

My specific requirement is to convert all entity beans into just un-annotated POJOs which will be used by plain JDBC controllers.

Sample code fragment:

@Entity
@NamedQueries({
    @NamedQuery(name = "Gpu.findAll", query = "SELECT g FROM GPU g"),
    @NamedQuery(name = "Gpu.findByArascl", query = "SELECT g FROM GPU g WHERE g.arascl = :arascl"),
    @NamedQuery(name = "Gpu.findByUnvan", query = "SELECT g FROM GPU g WHERE g.unvan = :unvan")})
public class GPU implements Serializable {

    @Id
    @Basic(optional = false)
    @Size(min = 1, max = 15)
    @Column(nullable = false, length = 15)
    private String arascl;
    @Column(name = "BAGLI_CALISAN_SAYISI")
    private int bagliCalisanSayisi;
    @Size(max = 24)
    @Column(name = "BOLGE_TANIMI", length = 24)
    private String bolgeTanimi;
    @Size(max = 35)
    @Column(length = 35)
    private String eladi;
    private Integer elmkod;
    @Size(max = 30)
    @Column(length = 30)
    private String elsoy;
    @Size(max = 30)
    @Column(name = "SUBE_TANIMI", length = 30)
fledglingCoder
  • 402
  • 9
  • 24

2 Answers2

3

Simply try Find&Replace for expressions with regex @.* to find all annotations.

JulianG
  • 1,551
  • 1
  • 19
  • 29
  • I added a code fragment from a class where you'll see why it's not a simple question of finding and replacing without using something more sophisticated such as regexp – fledglingCoder Oct 11 '13 at 08:47
  • Dont forget to mark the Regular Expression radio box in the Find window – Sarah Sh Nov 10 '21 at 11:24
1

Try use regexp to replace this:

@.+

with empty string.

Viktor Ozerov
  • 295
  • 3
  • 10