Class DTO

  • All Implemented Interfaces:

    public class DTO
    extends DTOWurblet
    (@wurblet) DTO creates code for a data transfer object.

    @wurblet <tag> DTO [--builder [--from]] <filename>


    • --builder: option to generate code according to the builder pattern.
    • --equals: option to generate the equals method.
    • --hashCode: option to generate the hashCode method.
    • --from: only if --builder set: generate method to create a builder from instance. This will automatically happen if the '+' option at set for at least one property.
    • filename: the file holding the DTO model.
    For more options, see AbstractWurblet.

    The model is usually stored in a heap-file such as ".$filename" created as a here-document within the leading comment block of the DTO-file.
    Each line describes a property.

     String  name    the object's name
     int     count   the counter
    If the line is prefixed with "^", the property is passed to the super entity within the constructor.
    In builder pattern mode, standard java inheritance must be used instead.
     ^String name   the name
    If the line is prefixed with "=" or "~", the property is mutable and a setter is generated. "~" marks the property transient as well.
    In builder pattern mode, no builder method is generated for this property.
     =String name   the name
    Only for builder mode: lines prefixed with "!" are considered as required and a TentackleRuntimeException is thrown by the build-method, if a required attribute was not configured. Notice that a required attribute is always immutable.
     !String name   the name
    For lines prefixed with "+" a from-Method is generated that creates a new DTO from the current one by replacing the given property.
     +String name   the name
    This would create an instance method "fromName(String name)" that returns a new DTO instance.

    The comment may contain optional annotations enclosed in square brackets.

     String name   the name [@Bindable(MAXCOL=20)] [@MyAnno]

    Annotations not belonging to a property are applied to all properties, if not already defined in the comment. Global annotations can be rmoved from a property with a leading dash or exclamation mark.

     String blah   the blah
     String blue   the blue not bindable [-@Bindable]

    If the builder pattern is used and the class extends a superclass, the builder is created as an extension of the superclass'es builder.

    Important: if --equals or --hashCode is given in a subclass, all superclasses must get those options as well!

    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()  
      • Methods inherited from class org.wurbelizer.wurblet.AbstractJavaWurblet

        getClassName, getPackageName, getSuperClassName, isAbstract, isFinal, isPrivate, isProtected, isPublic, toString
      • Methods inherited from class org.wurbelizer.wurblet.AbstractWurblet

        cleanup, getConfiguration, getContainer, getGuardName, getPhase, process, setConfiguration, setContainer, setPhase
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DTO

        public DTO()
    • Method Detail

      • run

        public void run()
                 throws org.wurbelizer.wurbel.WurbelException
        Specified by:
        run in interface org.wurbelizer.wurblet.Wurblet
        run in class DTOWurblet