Enum DtoMapping.Setter

java.lang.Object
java.lang.Enum<DtoMapping.Setter>
io.ebean.annotation.DtoMapping.Setter
All Implemented Interfaces:
Serializable, Comparable<DtoMapping.Setter>
Enclosing class:
DtoMapping

public static enum DtoMapping.Setter extends Enum<DtoMapping.Setter>
Target construction strategy - see DtoMapping.setter().
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Always use setter-based construction - a codegen-time error if the target has no usable no-arg-constructor-plus-setters shape.
    Use a detected setter-based construction path only when no builder was selected (see DtoMapping.Builder) and the target has no positional constructor matching the mapped properties, falling back silently to a positional constructor call otherwise.
    Never use setter-based construction, even if the target has a usable shape - always use a positional constructor instead (a codegen-time error if no matching one exists).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • AUTO

      public static final DtoMapping.Setter AUTO
      Use a detected setter-based construction path only when no builder was selected (see DtoMapping.Builder) and the target has no positional constructor matching the mapped properties, falling back silently to a positional constructor call otherwise.
    • ALWAYS

      public static final DtoMapping.Setter ALWAYS
      Always use setter-based construction - a codegen-time error if the target has no usable no-arg-constructor-plus-setters shape.

      Use this to pin a target to setter-based construction rather than relying on AUTO's shape-based fallback - e.g. a legacy JAXB/mutable-JavaBean target that happens to also expose a same-arity constructor AUTO would otherwise silently prefer instead (its parameter order may be coincidental, not actually intended for this mapping); or simply to document the intended strategy explicitly for readers. Also gives a clear @DtoMapping error - naming the missing setter - if a setter is later renamed or removed, rather than AUTO silently falling through to a positional constructor call that may not compile, or may compile but populate the wrong properties.

    • NEVER

      public static final DtoMapping.Setter NEVER
      Never use setter-based construction, even if the target has a usable shape - always use a positional constructor instead (a codegen-time error if no matching one exists).

      Use this to pin a target to positional-constructor construction rather than relying on AUTO's shape-based fallback - e.g. a target that happens to expose both a matching positional constructor and a full set of setters (so AUTO would already prefer the constructor anyway, but NEVER makes that guarantee explicit and future-proof: if the constructor is later removed/changed, the mapping fails to compile immediately instead of silently switching to a setter chain no one asked for).

  • Method Details

    • values

      public static DtoMapping.Setter[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DtoMapping.Setter valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null