Class MembersTemplate

java.lang.Object
de.japkit.test.members.MembersTemplate

@Clazz(commentExpr="The generated class for the example.")
@RuntimeMetadata
public class MembersTemplate
extends java.lang.Object
Within Templates annotated with Clazz, InnerClass or Template, fields, methods, constructors and inner classes can be generated. Clazz represents a top level class, InnerClass is an inner class within a top level class or another inner class. Template is a reusable group of members.

Here, some basic examples are shown on how to generate members and how to use Template.

  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    class  MembersTemplate.FieldWithMethod
    Members can be grouped together in Templates.
    class  MembersTemplate.SomeInnerClass
    An inner class template.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) java.lang.String fixedField
    A field within the generated top level class.
    (package private) ToStringTemplate generateToString
    Templates can also be made reusable by putting them into separate classes.
  • Constructor Summary

    Constructors 
    Constructor Description
    MembersTemplate​(java.lang.String param1, int param2)
    A constructor in the top level class.It is generated by "copying" the constructor template and adjusting the name.
  • Method Summary

    Modifier and Type Method Description
    void fixedMethod​(java.lang.String param)
    A method within the generated top level class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fixedField

      java.lang.String fixedField
      A field within the generated top level class. It is generated by "copying" the field template.
    • generateToString

      @TemplateCall ToStringTemplate generateToString
      Templates can also be made reusable by putting them into separate classes. Here, the ToStringTemplate is applied to add a toString method to the generated class.

      The type of the field is the template to be called. The name of the field is not relevant here.

  • Constructor Details

    • MembersTemplate

      public MembersTemplate​(java.lang.String param1, int param2)
      A constructor in the top level class.It is generated by "copying" the constructor template and adjusting the name.
  • Method Details

    • fixedMethod

      public void fixedMethod​(java.lang.String param)
      A method within the generated top level class. It is generated by "copying" the method template.