Interface DisplayValueFactory
- All Known Implementing Classes:
DisplayValueFactoryImpl
public interface DisplayValueFactory
Creates
DisplayValue
s from Strings.
Used to create DisplayValue
's based on prefixes or types.
Please look at the DisplayEvaluator
interface for a list of knows evaluator implementations.
-
Method Summary
Modifier and TypeMethodDescriptionCreates aDisplayValue
from a string and type.createByPrefix
(String string) Creates aDisplayValue
from a string.
-
Method Details
-
createByPrefix
Creates aDisplayValue
from a string. The prefix is used to determine what kind of display-value is returned.Use this method when you don't know the prefix or you don't want to extract it from the String by yourself. Falls back to the default evaluator when there are
- a) no evaluators
- b) or the string has a prefix which can't be handled
- c) or the string isn't prefixed at all
When you know the type, please use
create(String, String)
- Parameters:
string
- The label.- Returns:
- Created display value ready to evaluate.
-
create
Creates aDisplayValue
from a string and type.Checks for available evaluator for type and returns new
DisplayValue
based on it. Has no fallback to the default evaluator.The difference between this method and
createByPrefix(String)
is simply, that for this method you have to know the prefix before whereas increateByPrefix(String)
you can just pass the String and the prefix is extracted out of it.- Parameters:
type
- Type of the evalutator (entity, constant, textresource...).string
- The label to evaluate.- Returns:
- Display value which can be evaluated against the evaluator found by type.
- Throws:
IllegalArgumentException
- when evaluator is missing
-