static <T, I extends ChronoInterval<T>> I parsePattern(
        CharSequence text,
        IntervalCreator<T, I> factory,
        ChronoParser<T> parser,
        String pattern
    ) throws ParseException {

        ParseLog plog = new ParseLog();
        String[] components = pattern.split("\\|");

        for (String component : components) {
            plog.reset();
            I interval = IntervalParser.parseComponent(text, factory, parser, component, plog);

            if ((interval != null) && !plog.isError()) {
                return interval;
            }
        }

        if (plog.isError()) {
            throw new ParseException(plog.getErrorMessage(), plog.getErrorIndex());
        } else {
            throw new ParseException("Parsing of interval failed: " + text, plog.getPosition());
        }

    }
static < T , I extends ChronoInterval < T > > I parsePattern ( CharSequence text , IntervalCreator < T , I > factory , ChronoParser < T > parser , String pattern ) throws ParseException { ParseLog plog = new ParseLog ( ) ; String [ ] components = pattern . split ( "\\|" ) ; for ( String component : components ) { plog . reset ( ) ; I interval = IntervalParser . parseComponent ( text , factory , parser , component , plog ) ; if ( ( interval != null ) && ! plog . isError ( ) ) { return interval ; } } if ( plog . isError ( ) ) { throw new ParseException ( plog . getErrorMessage ( ) , plog . getErrorIndex ( ) ) ; } else { throw new ParseException ( "Parsing of interval failed: " + text , plog . getPosition ( ) ) ; } }
<p>Custom parsing using any kind of interval pattern (possibly with or-logic). </p>

@param   text        text to be parsed
@param   factory     interval factory
@param   parser      parser used for parsing either start or end component
@param   pattern     interval pattern containing the placeholders {0} or {1}
@return  parsed interval
@throws  ParseException if parsing fails
@since   4.18