Interface IReplacer<T extends IComponent>


  • public interface IReplacer<T extends IComponent>
    An IComponent replacer to replace the descendant from the root component.
    Author:
    jumperchen
    • Method Detail

      • replaceById

        IReplacer<T> replaceById​(java.lang.String source,
                                 IComponent<?> target)
        Replaces the given source with a given new IComponent in the descendant of the root.
        Parameters:
        source - The source to indicate the replaced source
        target - The new component for replacement. If null, it means to remove the replaced source.
      • replace

        <I extends IComponent<?>> IReplacer<T> replace​(I source,
                                                       I target)
        Replaces the given immutable component with a given new IComponent in the descendant of the root.
        Parameters:
        source - The old component to indicate the replaced source
        target - The new component for replacement. If null, it means to remove the replaced source.
      • replaceById

        <I extends IComponent<?>> IReplacer<T> replaceById​(java.lang.String source,
                                                           CheckedFunction<I,​I> targetFunction)
        Replaces the given source with a given new IComponent in the descendant of the root.
        Parameters:
        source - The source to indicate the replaced source
        targetFunction - The replacement function by passing the result of the source and returning the new replacement. If null, it means to remove the replaced source.
      • build

        T build()
        Builds a new component tree from each replacement.