All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.util.RegExpMatch Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.List;
import java.util.AbstractList;

public class RegExpMatch extends AbstractList implements List
{
  private Matcher _matcher;

  public RegExpMatch( Matcher matcher )
  {
    _matcher = matcher;
  }

  public String get( int index )
  {
    return _matcher.group( index + 1 );
  }

  public int size()
  {
    return _matcher.groupCount();
  }

  public Matcher getMatcher()
  {
    return _matcher;
  }

  public Pattern getPattern()
  {
    return _matcher.pattern();
  }

  /**
   * @deprecated RegExpMatch now implements List<String>, so it is
   * no longer necessary to call getGroups()
   */
  public List getGroups()
  {
    return this;
  }

  @Override
  public String toString() {
    return "[RegExpMatch: " + _matcher + "]";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy