简体   繁体   中英

About class template in eclipse, how to create a template for class?

I want to create many similar class that is:

inheritance a base class,
have some common annotations.

In eclipse, I can only create a class has a base class, so I wander if there a "template" mechanism in eclipse that can achieve this.

You can create various Java code templates in Eclipse via the

Window->Preferences->Java -> Editor -> Templates

class SampleClass<T> {
  private T sampleData;

  public SampleClass() {
  }

  public void set(T sampleData_) {
    sampleData = sampleData_;
  }
}

You probably apply the template like above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM