Class ThreadLocalMatcher


  • public class ThreadLocalMatcher
    extends java.lang.ThreadLocal<java.util.regex.Matcher>
    Provides a thread-local variables of Matchers.
    Since:
    1.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.regex.Pattern pattern  
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadLocalMatcher​(java.util.regex.Pattern pattern)
      Construct a new ThreadLocalMatcher instance with the specified pattern.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.regex.Matcher initialValue()  
      java.util.regex.Matcher matcher()
      Returns the thread-local matcher.
      java.util.regex.Pattern pattern()
      Return the pattern that create matchers.
      java.util.regex.Matcher reset​(java.lang.CharSequence input)
      Resets the thread-local matcher with a new input sequence.
      • Methods inherited from class java.lang.ThreadLocal

        get, remove, set, withInitial
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pattern

        protected final java.util.regex.Pattern pattern
    • Constructor Detail

      • ThreadLocalMatcher

        public ThreadLocalMatcher​(java.util.regex.Pattern pattern)
        Construct a new ThreadLocalMatcher instance with the specified pattern.
        Parameters:
        pattern - the pattern that create matchers
    • Method Detail

      • pattern

        public java.util.regex.Pattern pattern()
        Return the pattern that create matchers.
        Returns:
        the pattern that create matchers
      • initialValue

        protected java.util.regex.Matcher initialValue()
        Overrides:
        initialValue in class java.lang.ThreadLocal<java.util.regex.Matcher>
      • matcher

        public java.util.regex.Matcher matcher()
        Returns the thread-local matcher.

        This method is equivalent to ThreadLocal.get().

        Returns:
        the thread-local matcher
      • reset

        public java.util.regex.Matcher reset​(java.lang.CharSequence input)
        Resets the thread-local matcher with a new input sequence.
        Parameters:
        input - the new input character sequence
        Returns:
        the thread-local matcher