- java.lang.Object
-
- com.uddernetworks.newocr.configuration.HOCONFontConfiguration
-
- All Implemented Interfaces:
FontConfiguration
public class HOCONFontConfiguration extends java.lang.Object implements FontConfiguration
Reads a HOCON Configuration file and derives options from it.- Since:
- April 25, 2019
-
-
Constructor Summary
Constructors Constructor Description HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager)
Creates aHOCONFontConfiguration
with a given file name andReflectionCacher
(Which should be global across all instances of this current class)HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager, MergenceManager mergenceManager)
Creates aHOCONFontConfiguration
with a given file name andReflectionCacher
(Which should be global across all instances of this current class).
-
Method Summary
Modifier and Type Method Description void
fetchAndApplyMergeRules(MergenceManager mergenceManager)
Fetches the mergence rules' settings from the configuration and applies them to the givenMergenceManager
.void
fetchAndApplySimilarities()
Fetches the similarities' settings from the configuration and applies them to the givenSimilarityManager
.OCROptions
fetchOptions()
Generates and returns theOCROptions
from the file configuration.java.lang.String
getFileName()
Gets the file name theHOCONFontConfiguration
was generated from.java.lang.String
getFriendlyName()
The friendly version of the font name that should be displayed in messages/options.java.lang.String
getSystemName()
Gets the font name used by the OS to define it.java.util.Optional<java.lang.Class<MergeRule>>
loadMergeClass(java.lang.String className)
Loads a class that's an instance ofMergeRule
from the given fully qualified name .
-
-
-
Constructor Detail
-
HOCONFontConfiguration
public HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager, MergenceManager mergenceManager)
Creates aHOCONFontConfiguration
with a given file name andReflectionCacher
(Which should be global across all instances of this current class). This also includes aSimilarityManager
and aMergenceManager
to automatically invoke the methodsFontConfiguration.fetchAndApplySimilarities()
andFontConfiguration.fetchAndApplyMergeRules(MergenceManager)
in their respective order.- Parameters:
fileName
- The name of the filereflectionCacher
- TheReflectionCacher
to usesimilarityManager
- TheSimilarityManager
to usemergenceManager
- TheMergenceManager
to invokeFontConfiguration.fetchAndApplyMergeRules(MergenceManager)
on
-
HOCONFontConfiguration
public HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager)
Creates aHOCONFontConfiguration
with a given file name andReflectionCacher
(Which should be global across all instances of this current class)- Parameters:
fileName
- The name of the filereflectionCacher
- TheReflectionCacher
to usesimilarityManager
- TheSimilarityManager
to use
-
-
Method Detail
-
getFileName
public java.lang.String getFileName()
Description copied from interface:FontConfiguration
Gets the file name theHOCONFontConfiguration
was generated from.- Specified by:
getFileName
in interfaceFontConfiguration
- Returns:
- The file name
-
getFriendlyName
public java.lang.String getFriendlyName()
Description copied from interface:FontConfiguration
The friendly version of the font name that should be displayed in messages/options.- Specified by:
getFriendlyName
in interfaceFontConfiguration
- Returns:
- The friendly font name
-
getSystemName
public java.lang.String getSystemName()
Description copied from interface:FontConfiguration
Gets the font name used by the OS to define it. This shouldn't really be displayed to the user, unless the specific application requires it.- Specified by:
getSystemName
in interfaceFontConfiguration
- Returns:
- The font name by the OS
-
fetchOptions
public OCROptions fetchOptions()
Description copied from interface:FontConfiguration
Generates and returns theOCROptions
from the file configuration.- Specified by:
fetchOptions
in interfaceFontConfiguration
- Returns:
- The
OCROptions
from the settings
-
fetchAndApplySimilarities
public void fetchAndApplySimilarities()
Description copied from interface:FontConfiguration
Fetches the similarities' settings from the configuration and applies them to the givenSimilarityManager
. All similarities will be an instance ofBasicSimilarityRule
.- Specified by:
fetchAndApplySimilarities
in interfaceFontConfiguration
-
fetchAndApplyMergeRules
public void fetchAndApplyMergeRules(MergenceManager mergenceManager)
Description copied from interface:FontConfiguration
Fetches the mergence rules' settings from the configuration and applies them to the givenMergenceManager
.- Specified by:
fetchAndApplyMergeRules
in interfaceFontConfiguration
- Parameters:
mergenceManager
- TheMergenceManager
to apply all mergence rules to.
-
loadMergeClass
public java.util.Optional<java.lang.Class<MergeRule>> loadMergeClass(java.lang.String className)
Description copied from interface:FontConfiguration
Loads a class that's an instance ofMergeRule
from the given fully qualified name .- Specified by:
loadMergeClass
in interfaceFontConfiguration
- Parameters:
className
- The fully qualified name of the class to load- Returns:
- The class, if found
-
-