Package cdc.util.data.util
Interface AttributeNameConverter
-
- 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 AttributeNameConverter
Interface used to convert (replace) an attribute name.- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description static AttributeNameConverterIDENTITYAn attribute 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 AttributeNameConverterandThen(AttributeNameConverter other)Returns a converter that first applies this converter and thenother.default AttributeNameConvertercompose(AttributeNameConverter other)Returns a converter that first appliesotherthen this converter.StringconvertAttributeName(Element element, String name)Returns the name that should be used instead of the original name.static AttributeNameConverterfromNameFunction(UnaryOperator<String> function)Creates a new AttributeNameConverter from a name converter function.static AttributeNameConverterfromNameMap(Map<String,String> map)Creates a new AttributeNameConverter from a map.static AttributeNameConverterfromPathMap(Map<SPath,String> map)
-
-
-
Field Detail
-
IDENTITY
static final AttributeNameConverter IDENTITY
An attribute name converter that returns the name unchanged.
-
-
Method Detail
-
convertAttributeName
String convertAttributeName(Element element, String name)
Returns the name that should be used instead of the original name.- Parameters:
element- The element.name- The attribute name.- Returns:
- The name to use for attribute, instead of name.
-
compose
default AttributeNameConverter compose(AttributeNameConverter 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 AttributeNameConverter andThen(AttributeNameConverter 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 AttributeNameConverter fromNameFunction(UnaryOperator<String> function)
Creates a new AttributeNameConverter from a name converter function.Conversion is independent of element.
- Parameters:
function- The function used to convert attribute names.- Returns:
- A new AttributeValueConverter from
function. - Throws:
IllegalArgumentException- Whenfunctionisnull.
-
fromNameMap
static AttributeNameConverter 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 AttributeNameConverter fromPathMap(Map<SPath,String> map)
-
-