Interface CopyPolicy<I>


public interface CopyPolicy<I>
Copy policy interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final CopyPolicy<?>
    Default copy policy.
    static final CopyPolicy<?>
    Copy policy which always uses originals.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <I> CopyPolicy<I>
    compound(CopyPolicy<I>... policies)
    Returns compound or single policy depending on list size.
    static <I> CopyPolicy<I>
    compound(List<CopyPolicy<I>> policies)
    Returns compound or single policy depending on list size.
    static <I> CopyPolicy<I>
    Returns copy policy which always returns the same action.
    static <I> CopyPolicy<I>
    Returns default copy policy.
    getAction(I input)
    Returns action to apply to an input, which may be type, field or something else.
    static <I> CopyPolicy<I>
    Returns copy policy which always uses originals.
  • Field Details

    • DEFAULT

      static final CopyPolicy<?> DEFAULT
      Default copy policy.
    • ORIGINAL

      static final CopyPolicy<?> ORIGINAL
      Copy policy which always uses originals.
  • Method Details

    • getAction

      CopyAction getAction(I input)
      Returns action to apply to an input, which may be type, field or something else. Must return non-null value.
      Parameters:
      input - input object
      Returns:
      copy action
    • constant

      static <I> CopyPolicy<I> constant(CopyAction action)
      Returns copy policy which always returns the same action.
      Type Parameters:
      I - input object type
      Parameters:
      action - action
      Returns:
      copy policy which always returns the same action
    • defaultPolicy

      static <I> CopyPolicy<I> defaultPolicy()
      Returns default copy policy.
      Type Parameters:
      I - input object type
      Returns:
      default copy policy
    • original

      static <I> CopyPolicy<I> original()
      Returns copy policy which always uses originals.
      Type Parameters:
      I - input object type
      Returns:
      copy policy which always uses originals
    • compound

      @SafeVarargs static <I> CopyPolicy<I> compound(CopyPolicy<I>... policies)
      Returns compound or single policy depending on list size. Compound copy policy searches for the first non-default action in the list of policies.
      Type Parameters:
      I - input type
      Parameters:
      policies - list of policies
      Returns:
      compound or single policy
    • compound

      static <I> CopyPolicy<I> compound(List<CopyPolicy<I>> policies)
      Returns compound or single policy depending on list size. Compound copy policy searches for the first non-default action in the list of policies.
      Type Parameters:
      I - input type
      Parameters:
      policies - list of policies
      Returns:
      compound or single policy