Package com.helger.css.reader
Class CSSReaderSettings
java.lang.Object
com.helger.css.reader.CSSReaderSettings
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSReaderSettings>
public class CSSReaderSettings
extends Object
implements com.helger.commons.lang.ICloneable<CSSReaderSettings>
A settings class for usage with
CSSReader.- Since:
- 3.8.2
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final Charsetstatic final booleanstatic final intstatic final booleanstatic final ECSSVersion -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClone()intbooleanbooleanbooleansetBrowserCompliantMode(boolean bBrowserCompliantMode) Change the browser compliant mode to use.setCSSVersion(ECSSVersion eCSSVersion) Set the CSS version to be read.setCustomErrorHandler(ICSSParseErrorHandler aCustomErrorHandler) setCustomExceptionHandler(ICSSParseExceptionCallback aCustomExceptionHandler) setFallbackCharset(Charset aFallbackCharset) setInterpretErrorHandler(ICSSInterpretErrorHandler aInterpretErrorHandler) Set a special interpret error handler for handling errors in successfully parsed CSS.setKeepDeprecatedProperties(boolean bKeepDeprecatedProperties) Define, whether deprecated properties (e.g.setTabSize(int nTabSize) Set the tab size to be used to determine the source location.setUseSourceLocation(boolean bUseSourceLocation) Change if source location should be used or not.toString()
-
Field Details
-
DEFAULT_VERSION
-
DEFAULT_CHARSET
-
DEFAULT_BROWSER_COMPLIANT_MODE
public static final boolean DEFAULT_BROWSER_COMPLIANT_MODE- See Also:
-
DEFAULT_KEEP_DEPRECATED_PROPERTIES
public static final boolean DEFAULT_KEEP_DEPRECATED_PROPERTIES- See Also:
-
DEFAULT_USE_SOURCE_LOCATION
public static final boolean DEFAULT_USE_SOURCE_LOCATION- See Also:
-
DEFAULT_TAB_SIZE
public static final int DEFAULT_TAB_SIZE- See Also:
-
-
Constructor Details
-
CSSReaderSettings
public CSSReaderSettings() -
CSSReaderSettings
-
-
Method Details
-
getCSSVersion
- Returns:
- The CSS version which should be read. Defaults to
DEFAULT_VERSION. Nevernull.
-
setCSSVersion
Set the CSS version to be read.- Parameters:
eCSSVersion- The version number to use. May not benull.- Returns:
- this
-
getFallbackCharset
- Returns:
- The charset to be used for reading a CSS file in case neither a
@charsetrule nor a BOM is present. Nevernull. Defaults toDEFAULT_CHARSET.
-
getFallbackCharsetName
- Returns:
- The name of the charset to be used for reading a CSS file in case
neither a
@charsetrule nor a BOM is present. Nevernull. Defaults to the name ofDEFAULT_CHARSET.
-
setFallbackCharset
- Parameters:
aFallbackCharset- The charset to be used for reading the CSS file in case neither a@charsetrule nor a BOM is present. May not benull.- Returns:
- this
-
getCustomErrorHandler
- Returns:
- An optional custom error handler that can be used to collect the
recoverable parsing errors. May be
null.
-
setCustomErrorHandler
@Nonnull public CSSReaderSettings setCustomErrorHandler(@Nullable ICSSParseErrorHandler aCustomErrorHandler) - Parameters:
aCustomErrorHandler- A custom error handler that can be used to collect the recoverable parsing errors. May benull.- Returns:
- this
-
getCustomExceptionHandler
- Returns:
- An optional custom exception handler that can be used to collect
the unrecoverable parsing errors. May be
null.
-
setCustomExceptionHandler
@Nonnull public CSSReaderSettings setCustomExceptionHandler(@Nullable ICSSParseExceptionCallback aCustomExceptionHandler) - Parameters:
aCustomExceptionHandler- A custom exception handler that can be used to collect the unrecoverable parsing errors. May benull.- Returns:
- this
-
isBrowserCompliantMode
public boolean isBrowserCompliantMode()- Returns:
trueif browser compliant parsing is enabled,falseotherwise. The default isDEFAULT_BROWSER_COMPLIANT_MODE.
-
setBrowserCompliantMode
Change the browser compliant mode to use.- Parameters:
bBrowserCompliantMode-trueto use enable browser compliant parsing,falseto disable it.- Returns:
- this
-
isKeepDeprecatedProperties
public boolean isKeepDeprecatedProperties()- Returns:
trueif deprecated properties (e.g.*zoom) should be kept while reading,falseif they should be discarded. The default isDEFAULT_KEEP_DEPRECATED_PROPERTIES.- Since:
- 7.0.4
-
setKeepDeprecatedProperties
Define, whether deprecated properties (e.g.*zoom) should be kept or not.- Parameters:
bKeepDeprecatedProperties-trueto keep them,falseto discard them on reading.- Returns:
- this
- Since:
- 7.0.4
-
isUseSourceLocation
public boolean isUseSourceLocation()- Returns:
trueif the source location should be stored,falseto ignore them. The default isDEFAULT_USE_SOURCE_LOCATION.- Since:
- 6.1.3
-
setUseSourceLocation
Change if source location should be used or not. If source location usage is disabled, it improves parsing speed.- Parameters:
bUseSourceLocation-trueto remember the source location,falseto ignore them.- Returns:
- this
- Since:
- 6.1.3
-
getTabSize
- Returns:
- The tab size to be used to determine the source location. Always
> 0. Default value is
DEFAULT_TAB_SIZE. - Since:
- 5.0.2
-
setTabSize
Set the tab size to be used to determine the source location.- Parameters:
nTabSize- The tab size to use. Must be > 0.- Returns:
- this for chaining
- Since:
- 5.0.2
-
getInterpretErrorHandler
- Returns:
- The special error handler to be used to interpret a successfully
parsed CSS. May be
null. If this isnullthe default error handler fromCSSReaderis used. - Since:
- 5.0.2
-
setInterpretErrorHandler
@Nonnull public CSSReaderSettings setInterpretErrorHandler(@Nullable ICSSInterpretErrorHandler aInterpretErrorHandler) Set a special interpret error handler for handling errors in successfully parsed CSS.- Parameters:
aInterpretErrorHandler- The special error handler to be used. May benullto indicate to use the default error handler fromCSSReader.- Returns:
- this for chaining
- Since:
- 5.0.2
-
getClone
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSReaderSettings>
-
toString
-