1. Project Clover database mar. janv. 20 2026 12:32:22 CET
  2. Package org.devacfr.maven.skins.reflow.snippet

File ComponentToken.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
10
7
2
120
42
7
0,7
1,43
3,5
1

Classes

Class Line # Actions
ComponentToken 28 10 0% 7 0
1.0100%
ComponentToken.Tag 34 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 26 tests. .

Source view

1    /*
2    * Copyright 2012-2025 Christophe Friederich
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.devacfr.maven.skins.reflow.snippet;
17   
18    import com.google.common.base.MoreObjects;
19    import org.devacfr.maven.skins.reflow.snippet.SnippetComponent.Type;
20    import org.jsoup.nodes.Element;
21   
22    /**
23    * Component token.
24    *
25    * @author Christophe Friederich
26    * @version 2.4
27    */
 
28    public class ComponentToken {
29   
30    /**
31    * @author Christophe Friederich
32    * @version 2.4
33    */
 
34    public enum Tag {
35    /** empty-tag */
36    empty,
37    /** start-tag */
38    start,
39    /** end-tag */
40    end,
41    /** end-tag */
42    html
43    }
44   
45    /** */
46    private final Element element;
47   
48    /** */
49    private final Tag tag;
50   
51    /** */
52    private final Type type;
53   
54    /** */
55    private final String name;
56   
57    /**
58    * Constructor.
59    *
60    * @param element
61    * the element
62    * @param name
63    * the name
64    * @param tag
65    * the tag
66    */
 
67  98 toggle public ComponentToken(final Element element, final String name, final Tag tag, final Type type) {
68  98 this.element = element;
69  98 this.name = name;
70  98 this.tag = tag;
71  98 this.type = type;
72    }
73   
74    /**
75    * @return the element
76    */
 
77  87 toggle public Element getElement() {
78  87 return element;
79    }
80   
81    /**
82    * @return the name
83    */
 
84  11 toggle public String name() {
85  11 return name;
86    }
87   
88    /**
89    * @return the tag
90    */
 
91  147 toggle public Tag tag() {
92  147 return tag;
93    }
94   
95    /**
96    * @return the type
97    */
 
98  49 toggle public Type type() {
99  49 return type;
100    }
101   
102    /**
103    * @param startElement
104    * the start element
105    * @return true if this element is the close tag of the given start element
106    */
 
107  38 toggle public boolean isCloseTagOf(final ComponentToken startElement) {
108  38 return name.equals(startElement.name) && type.equals(startElement.type) && Tag.start.equals(startElement.tag)
109    && Tag.end.equals(tag);
110    }
111   
112    /**
113    * {@inheritDoc}
114    */
 
115  163 toggle @Override
116    public String toString() {
117  163 return MoreObjects.toStringHelper(this).add("name", name).add("type", type).add("tag", tag).toString();
118   
119    }
120    }