Enum Replacements.CoalescePolicy

java.lang.Object
java.lang.Enum<Replacements.CoalescePolicy>
com.google.errorprone.fixes.Replacements.CoalescePolicy
All Implemented Interfaces:
Serializable, Comparable<Replacements.CoalescePolicy>, java.lang.constant.Constable
Enclosing class:
Replacements

public static enum Replacements.CoalescePolicy
extends Enum<Replacements.CoalescePolicy>
A policy for handling overlapping insertions.
  • Enum Constant Details

    • REJECT

      public static final Replacements.CoalescePolicy REJECT
      Reject overlapping insertions and throw an IllegalArgumentException.
    • REPLACEMENT_FIRST

      public static final Replacements.CoalescePolicy REPLACEMENT_FIRST
      Accept overlapping insertions, with the new insertion before the existing one. Duplicate insertions (inserting the same text at the same position) will still be dropped.
    • EXISTING_FIRST

      public static final Replacements.CoalescePolicy EXISTING_FIRST
      Accept overlapping insertions, with the existing insertion before the new one. Duplicate insertions (inserting the same text at the same position) will still be dropped.
    • KEEP_ONLY_IDENTICAL_INSERTS

      public static final Replacements.CoalescePolicy KEEP_ONLY_IDENTICAL_INSERTS
      Reject overlapping inserts, but treat duplicate inserts (same text at same position) specially. Instead of dropping duplicates, as the other coalesce policies do, this policy keeps them.
  • Method Details

    • values

      public static Replacements.CoalescePolicy[] 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 Replacements.CoalescePolicy 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
    • coalesce

      public abstract String coalesce​(String replacement, String existing)
      Handle two insertions at the same position.
      Parameters:
      replacement - the replacement being added
      existing - the existing insert at this position
      Returns:
      the coalesced replacement