View Javadoc
1   /* 
2    * Licensed under the Apache License, Version 2.0 (the "License");
3    * you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at
5    *
6    * http://www.apache.org/licenses/LICENSE-2.0
7    *
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11   * See the License for the specific language governing permissions and
12   * limitations under the License.
13   *
14   */
15  package org.esigate.parser.future;
16  
17  /**
18   * An element type. There must be one FutureElement type for each type of tags the parser has to look for in the pages
19   * <p>
20   * This class is based on ElementType
21   * 
22   * @see org.esigate.parser.ElementType
23   * 
24   * @author Nicolas Richeton
25   * 
26   */
27  public interface FutureElementType {
28      /**
29       * Detects an opening tag for this element type.
30       * 
31       * @param tag
32       *            The String to check
33       * @return Returns true if the String is an opening tag
34       */
35      boolean isStartTag(String tag);
36  
37      /**
38       * Detects if a tag is self closed or does not require a matching end tag. Ex: &lt;br /&gt;
39       * 
40       * @param tag
41       *            The String to check
42       * @return Returns true if the String is a self closing tag
43       */
44      boolean isSelfClosing(String tag);
45  
46      /**
47       * Detects a closing tag for this element type.
48       * 
49       * @param tag
50       *            The String to check
51       * @return Returns true if the String is a closing tag
52       */
53      boolean isEndTag(String tag);
54  
55      /**
56       * @return A new instance of the corresponding element class
57       */
58      FutureElement newInstance();
59  }