Package: org.grails.encoder

## [Java] Class DefaultEncodingStateRegistry

- org.grails.encoder.DefaultEncodingStateRegistry

- All Implemented Interfaces and Traits:
    EncodingStateRegistry

      public final class DefaultEncodingStateRegistry
      extends java.lang.Object
      implements EncodingStateRegistry

  default implementation of EncodingStateRegistry

  Authors:
    Lari Hotari
  Since:
    2.3

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private static org.slf4j.Logger` | `LOG` |
    `static StreamingEncoder` | `NONE_ENCODER` |
    `private java.util.Map<Encoder, java.util.Map<java.lang.Long, java.lang.ref.WeakReference<java.lang.CharSequence>>>` | `encodedCharSequencesForEncoder` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `private long` | `calculateKey(java.lang.CharSequence charSequence)`
    `` | `private java.util.Map<java.lang.Long, java.lang.ref.WeakReference<java.lang.CharSequence>>` | `getEncodedCharSequencesForEncoder(Encoder encoder)`
    `` | `public EncodingState` | `getEncodingStateFor(java.lang.CharSequence string)`
    `` | `public boolean` | `isEncodedWith(Encoder encoder, java.lang.CharSequence string)`
    `` | `public static boolean` | `isNoneEncoder(Encoder encoderToApply)`
    `` | `public static boolean` | `isPreviousEncoderSafeOrEqual(Encoder encoderToApply, Encoder previousEncoder)` Checks if is previous encoder is already "safe", equal or equivalent
    `` | `public void` | `registerEncodedWith(Encoder encoder, java.lang.CharSequence escaped)`
    `` | `public boolean` | `shouldEncodeWith(Encoder encoderToApply, java.lang.CharSequence string)`
    `` | `public static boolean` | `shouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState)` Checks if encoder should be applied to a input with given encoding state

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Field Detail

    - #### private static final org.slf4j.Logger LOG

    - #### public static final StreamingEncoder NONE_ENCODER

    - #### private java.util.Map<Encoder, java.util.Map<java.lang.Long, java.lang.ref.WeakReference<java.lang.CharSequence>>> encodedCharSequencesForEncoder

  - ### Method Detail

    - #### private long calculateKey(java.lang.CharSequence charSequence)

    - #### private java.util.Map<java.lang.Long, java.lang.ref.WeakReference<java.lang.CharSequence>> getEncodedCharSequencesForEncoder(Encoder encoder)

    - #### public EncodingState getEncodingStateFor(java.lang.CharSequence string)

    - #### public boolean isEncodedWith(Encoder encoder, java.lang.CharSequence string)

    - #### public static boolean isNoneEncoder(Encoder encoderToApply)

    - #### public static boolean isPreviousEncoderSafeOrEqual(Encoder encoderToApply, Encoder previousEncoder)

      Checks if is previous encoder is already "safe", equal or equivalent

      Parameters:
        `encoderToApply` - the encoder to apply
        `previousEncoder` - the previous encoder
      Returns:
        true, if previous encoder is already "safe", equal or equivalent

    - #### public void registerEncodedWith(Encoder encoder, java.lang.CharSequence escaped)

    - #### public boolean shouldEncodeWith(Encoder encoderToApply, java.lang.CharSequence string)

    - #### public static boolean shouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState)

      Checks if encoder should be applied to a input with given encoding state

      Parameters:
        `encoderToApply` - the encoder to apply
        `currentEncodingState` - the current encoding state
      Returns:
        true, if should encode