org.apache.ode.utils.cli

## Class Fragments

- java.lang.Object
- - org.apache.ode.utils.cli.Fragments

-     public class Fragments
      extends java.lang.Object

  Represents a commandline format as an ordered list of `CommandlineFragment`s that are applied to an array of arguments.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Fragments(CommandlineFragment[] frags)` Create a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CommandlineFragment[]` | `getFragments()` Used after the `matches(String[])` method, this returns the fragments together with the settings that they have absorbed from the arguments.
    `CommandlineFragment[]` | `getFragmentsInUserOrder()` For use in formatting commandline help, this method orders the constituent fragments in a way that would make sense to a user.
    `CommandlineSyntaxException` | `getReason()` Used after the `matches(String[])` method, this returns the reason, if any, that one of the `CommandlineFragment`s failed to parse the set of arguments.
    `boolean` | `matches(java.lang.String[] s)` Apply the `CommandlineFragment`s to the supplied arguments (after calling reset on the components).
    `void` | `resetFragments()` Reset the constituent fragments to their initial states.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Fragments

          public Fragments(CommandlineFragment[] frags)

      Create a new instance.

      Parameters:
        `frags` - the `CommandlineFragment`s that make up the commandline

  - ### Method Detail

    - #### resetFragments

          public void resetFragments()

      Reset the constituent fragments to their initial states.

    - #### getFragments

          public CommandlineFragment[] getFragments()

      Used after the `matches(String[])` method, this returns the fragments together with the settings that they have absorbed from the arguments. The fragments are returned in order of application, which is not necessarily the order that the user would see the relevant entries on the commandline.

      Returns:
        the array of fragments
      See Also:
        `getFragmentsInUserOrder()`

    - #### getFragmentsInUserOrder

          public CommandlineFragment[] getFragmentsInUserOrder()

      For use in formatting commandline help, this method orders the constituent fragments in a way that would make sense to a user. Otherwise, this method is identical to `getFragments()`.

      Returns:
        the array of fragments in the order that makes sense to the user
      See Also:
        `getFragments()`

    - #### getReason

          public CommandlineSyntaxException getReason()

      Used after the `matches(String[])` method, this returns the reason, if any, that one of the `CommandlineFragment`s failed to parse the set of arguments.

      Returns:

    - #### matches

          public boolean matches(java.lang.String[] s)

      Apply the `CommandlineFragment`s to the supplied arguments (after calling reset on the components).

      Parameters:
        `s` - the arguments, e.g., as passed to a `main(...)`
      Returns:
        `true` if the `CommandlineFragment`s succeeded in consuming the arguments.