Package cdc.util.data.util
Interface ElementNameConverter
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ElementNameConverter
Interface used to convert an element name.- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description static ElementNameConverterIDENTITYAn element name converter that returns the name unchanged.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ElementNameConverterandThen(ElementNameConverter other)Returns a converter that first applies this converter and thenother.default ElementNameConvertercompose(ElementNameConverter other)Returns a converter that first appliesotherthen this converter.StringconvertElementName(Parent parent, String name)Returns the element name to use instead of the original name.static ElementNameConverterfromNameFunction(UnaryOperator<String> function)Creates a new ElementNameConverter from a name converter function.static ElementNameConverterfromNameMap(Map<String,String> map)Creates a new AttributeNameConverter from a map.static ElementNameConverterfromPathMap(Map<SPath,String> map)
-
-
-
Field Detail
-
IDENTITY
static final ElementNameConverter IDENTITY
An element name converter that returns the name unchanged.
-
-
Method Detail
-
convertElementName
String convertElementName(Parent parent, String name)
Returns the element name to use instead of the original name.- Parameters:
parent- The element parent.name- The element name.- Returns:
- The name to use for the element, instead of name.
-
compose
default ElementNameConverter compose(ElementNameConverter other)
Returns a converter that first appliesotherthen this converter.- Parameters:
other- The other converter.- Returns:
- A converter that first applies
otherthen this converter. - Throws:
IllegalArgumentException- Whenotherisnull.
-
andThen
default ElementNameConverter andThen(ElementNameConverter other)
Returns a converter that first applies this converter and thenother.- Parameters:
other- The other converter.- Returns:
- A converter that first applies this converter and then
other. - Throws:
IllegalArgumentException- Whenotherisnull.
-
fromNameFunction
static ElementNameConverter fromNameFunction(UnaryOperator<String> function)
Creates a new ElementNameConverter from a name converter function.Conversion is independent of element.
- Parameters:
function- The function used to convert elements names.- Returns:
- A new ElementNameConverter from
function. - Throws:
IllegalArgumentException- Whenfunctionisnull.
-
fromNameMap
static ElementNameConverter fromNameMap(Map<String,String> map)
Creates a new AttributeNameConverter from a map.Conversion is independent of element.
If a name is not mapped, then result is that name.- Parameters:
map- The map.- Returns:
- A new AttributeValueConverter from
map. - Throws:
IllegalArgumentException- Whenmapisnull.
-
fromPathMap
static ElementNameConverter fromPathMap(Map<SPath,String> map)
-
-