Class AbstractFactory<E>
java.lang.Object
com.sk89q.worldedit.internal.registry.AbstractFactory<E>
- Type Parameters:
E
- the element that the factory returns
- Direct Known Subclasses:
BlockFactory
,ItemFactory
,MaskFactory
,PatternFactory
,TransformFactory
An abstract implementation of a factory for internal usage.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractFactory
(WorldEdit worldEdit, InputParser<E> defaultParser) Create a new factory. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsAlias
(String alias) Test all parsers to see if alias is contained by one of themList<InputParser<E>>
Gets an immutable list of parsers.getSuggestions
(String input) parseFromInput
(String input, ParserContext context) Parse a string and context to eachInputParser
added to this factory.void
register
(InputParser<E> inputParser) Registers an InputParser to this factory.
-
Field Details
-
worldEdit
-
-
Constructor Details
-
AbstractFactory
Create a new factory.- Parameters:
worldEdit
- the WorldEdit instancedefaultParser
- the parser to fall back to
-
-
Method Details
-
getParsers
Gets an immutable list of parsers.To add parsers, use the register method.
- Returns:
- the parsers
-
parseFromInput
Parse a string and context to eachInputParser
added to this factory. If no result found, throwsInputParseException
- Parameters:
input
- input stringcontext
- input context- Returns:
- parsed result
- Throws:
InputParseException
- if no result found
-
getSuggestions
-
register
Registers an InputParser to this factory.- Parameters:
inputParser
- The input parser
-
containsAlias
Test all parsers to see if alias is contained by one of them- Parameters:
alias
- alias to test- Returns:
- if a parser contains the alias
-