Class DefaultEncodingStateRegistry

java.lang.Object
org.grails.encoder.DefaultEncodingStateRegistry
All Implemented Interfaces:
EncodingStateRegistry

public final class DefaultEncodingStateRegistry extends Object implements EncodingStateRegistry
default implementation of EncodingStateRegistry
Since:
2.3
  • Field Details

  • Constructor Details

    • DefaultEncodingStateRegistry

      public DefaultEncodingStateRegistry()
  • Method Details

    • getEncodingStateFor

      public EncodingState getEncodingStateFor(CharSequence string)
      Description copied from interface: EncodingStateRegistry
      Gets the current encoding state for a CharSequence.
      Specified by:
      getEncodingStateFor in interface EncodingStateRegistry
      Parameters:
      string - a CharSequence
      Returns:
      the encoding state for the CharSequence
    • isEncodedWith

      public boolean isEncodedWith(Encoder encoder, CharSequence string)
      Description copied from interface: EncodingStateRegistry
      Checks if the CharSequence is encoded with encoder.
      Specified by:
      isEncodedWith in interface EncodingStateRegistry
      Parameters:
      encoder - the encoder
      string - a CharSequence
      Returns:
      true, if it is encoded with encoder
    • registerEncodedWith

      public void registerEncodedWith(Encoder encoder, CharSequence escaped)
      Description copied from interface: EncodingStateRegistry
      Registers that the CharSequence has been encoded with encoder
      Specified by:
      registerEncodedWith in interface EncodingStateRegistry
      Parameters:
      encoder - the encoder
      escaped - the CharSequence
    • shouldEncodeWith

      public boolean shouldEncodeWith(Encoder encoderToApply, CharSequence string)
      Description copied from interface: EncodingStateRegistry
      Checks if a encoder should be applied to a CharSequence
      Specified by:
      shouldEncodeWith in interface EncodingStateRegistry
      Parameters:
      encoderToApply - the encoder to apply
      string - a CharSequence
      Returns:
      true, if it should be applied
    • shouldEncodeWith

      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
    • isNoneEncoder

      public static boolean isNoneEncoder(Encoder encoderToApply)
    • isPreviousEncoderSafeOrEqual

      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