Package org.grails.encoder
Class DefaultEncodingStateRegistry
- java.lang.Object
-
- org.grails.encoder.DefaultEncodingStateRegistry
-
- All Implemented Interfaces:
EncodingStateRegistry
public final class DefaultEncodingStateRegistry extends java.lang.Object implements EncodingStateRegistry
default implementation ofEncodingStateRegistry- Since:
- 2.3
-
-
Field Summary
Fields Modifier and Type Field Description static StreamingEncoderNONE_ENCODER
-
Constructor Summary
Constructors Constructor Description DefaultEncodingStateRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EncodingStategetEncodingStateFor(java.lang.CharSequence string)Gets the current encoding state for a CharSequence.booleanisEncodedWith(Encoder encoder, java.lang.CharSequence string)Checks if the CharSequence is encoded with encoder.static booleanisNoneEncoder(Encoder encoderToApply)static booleanisPreviousEncoderSafeOrEqual(Encoder encoderToApply, Encoder previousEncoder)Checks if is previous encoder is already "safe", equal or equivalentvoidregisterEncodedWith(Encoder encoder, java.lang.CharSequence escaped)Registers that the CharSequence has been encoded with encoderbooleanshouldEncodeWith(Encoder encoderToApply, java.lang.CharSequence string)Checks if a encoder should be applied to a CharSequencestatic booleanshouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState)Checks if encoder should be applied to a input with given encoding state
-
-
-
Field Detail
-
NONE_ENCODER
public static final StreamingEncoder NONE_ENCODER
-
-
Method Detail
-
getEncodingStateFor
public EncodingState getEncodingStateFor(java.lang.CharSequence string)
Description copied from interface:EncodingStateRegistryGets the current encoding state for a CharSequence.- Specified by:
getEncodingStateForin interfaceEncodingStateRegistry- Parameters:
string- a CharSequence- Returns:
- the encoding state for the CharSequence
-
isEncodedWith
public boolean isEncodedWith(Encoder encoder, java.lang.CharSequence string)
Description copied from interface:EncodingStateRegistryChecks if the CharSequence is encoded with encoder.- Specified by:
isEncodedWithin interfaceEncodingStateRegistry- Parameters:
encoder- the encoderstring- a CharSequence- Returns:
- true, if it is encoded with encoder
-
registerEncodedWith
public void registerEncodedWith(Encoder encoder, java.lang.CharSequence escaped)
Description copied from interface:EncodingStateRegistryRegisters that the CharSequence has been encoded with encoder- Specified by:
registerEncodedWithin interfaceEncodingStateRegistry- Parameters:
encoder- the encoderescaped- the CharSequence
-
shouldEncodeWith
public boolean shouldEncodeWith(Encoder encoderToApply, java.lang.CharSequence string)
Description copied from interface:EncodingStateRegistryChecks if a encoder should be applied to a CharSequence- Specified by:
shouldEncodeWithin interfaceEncodingStateRegistry- Parameters:
encoderToApply- the encoder to applystring- 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 applycurrentEncodingState- 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 applypreviousEncoder- the previous encoder- Returns:
- true, if previous encoder is already "safe", equal or equivalent
-
-