Class SetGetAdd

  • All Implemented Interfaces:
    Consumer<File>

    public final class SetGetAdd
    extends Object
    implements Consumer<File>
    Control that is used to generate setters, getters and adders for fields in the specified class.
    Author:
    Emil Forslund
    • Constructor Detail

      • SetGetAdd

        public SetGetAdd()
        Initializes the control with all methods included.
      • SetGetAdd

        public SetGetAdd​(BiPredicate<Field,​Method> onlyInclude)
        Initializes the control but with only some Methods included. The input of the BiPredicate will be the field in the class that the method is generated for and the suggested method to add to the class.
        Parameters:
        onlyInclude - a filter for methods to include
    • Method Detail

      • accept

        public void accept​(File file)
        Generates getters, setters and adders for the fields in the specified model and sets the fields to private. Method signatures that has been excluded in the construction of this control will be excluded from the generation.

        For fields of a subtype to Collection, an 'adder' will be generated instead of a 'setter'.

        For fields of type Optional, the inner type will be used in the setter parameter but the wrapped type will be used as output for the getter.

        Specified by:
        accept in interface Consumer<File>
        Parameters:
        file - the model to generate for