View Javadoc

1   package io.github.reggert.reb4j;
2   
3   import java.util.regex.Pattern;
4   
5   /**
6    * Base implementation of {@link Expression}.
7    *
8    * This class provides the canonical implementations of {@link #toString()}
9    * and {@link #toPattern()}.
10   */
11  public abstract class AbstractExpression implements Expression 
12  {
13  	private static final long serialVersionUID = 1L;
14  
15  	/**
16  	 * Always returns the same value as {@link io.github.reggert.reb4j.Expression#expression}.
17  	 */
18  	@Override
19  	public final String toString()
20  	{return expression().toString();}
21  
22  	@Override
23  	public final Pattern toPattern()
24  	{return Pattern.compile(toString());}
25  
26  }