- java.lang.Object
-
- uk.autores.handling.GenerateStringsFromText
-
- All Implemented Interfaces:
Handler
public final class GenerateStringsFromText extends Object implements Handler
Handlerthat generates classes that returns file contents asStrings.For each resource, generates a class with a name derived from the resource name using
Namer.simplifyResourceName(String)andNamer.nameType(String). The class will have a static method calledtextthat returns the resource as aString.Resource files over
Integer.MAX_VALUEin size will result in an error during compilation.The
CharsetDecoderis configured withCodingErrorAction.REPORTon malformed input or unmappable characters which will result in build failures.
-
-
Constructor Summary
Constructors Constructor Description GenerateStringsFromText()Ctor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<ConfigDef>config()All configuration is optional.voidhandle(Context context)Handles the context resources.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.autores.handling.Handler
validConfig
-
-
-
-
Method Detail
-
config
public Set<ConfigDef> config()
All configuration is optional.
"UTF-8" is assumed if "encoding" is not set and this is the recommended encoding.
Use "visibility" to make the generated classes public.
Strategy:CfgStrategy.AUTO:CfgStrategy.INLINEfor files up to 65535B when encoded as modified UTF-8 - the limit for a String constant;CfgStrategy.LAZYotherwiseCfgStrategy.INLINE: files becomeStringliteralsCfgStrategy.CONST: alias forCfgStrategy.INLINECfgStrategy.LAZY: files are loaded using theClassLoader
The lazy strategy requires that the resource file be provided at runtime. The inline strategy will break down as the resource file approaches 500MB due to class file limitations.
- Specified by:
configin interfaceHandler- Returns:
- visibility; encoding; strategy
- See Also:
CfgVisibility,CfgEncoding,CfgStrategy
-
-