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 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.
      • 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 - When function is null.
      • 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 - When map is null.