This Addon requires the following installation steps.
To use this addon, you must add it as a dependency in the pom.xml of your forge-addon
classified artifact:
<dependency>
<groupId>org.jboss.forge.addon.text</groupId>
<artifactId>text</artifactId>
<classifier>forge-addon</classifier>
<version>${version}</version>
</dependency>
- Inflector for performing inflection on words
-
Allows for camelcasing, capitalization, humanization, pluralization etc. of words.
@Inject private Inflector inflector; String plural = inflector.pluralize("foo");
- Highligher to color code syntax in terminal output
-
Allows for color coding of the following content types:
-
JAVA
-
JSON
-
JAVASCRIPT
-
CSS
-
HTML (with inline JavaScript/CSS)
-
When working with files you can rely on the Highlighter
to determine the syntax based on the filename.
@Inject private Highlighter highlighter;
highlighter.byFileName(resource.getName(), resource.getContents(), output.out());
When working with pure content you can specify the source syntax via the contentType argument.
@Inject private Highlighter highlighter;
highlighter.byType("JAVA", resource.getContents(), output.out());
You can provide your own resource tokenizer for the Highlighter
to use by implementing the interface
org.jboss.forge.addon.text.highlight.Scanner
, and expose it either as a CDI bean or registered as a
simple service via the org.jboss.forge.furnace.container.simple.Service
services file.
Tip
|
If your addon uses a container that does not support "@Inject" annotations, services such as the Imported<Inflector> imported = addonRegistry.getServices(Inflector.class); Inflector inflector = imported.get(); |