1. Project Clover database mar. avr. 16 2024 08:19:06 CEST
  2. Package org.devacfr.maven.skins.reflow.snippet

File ComponentToken.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
10% of files have more coverage

Code metrics

0
10
7
3
109
45
7
0,7
1,43
2,33
1

Classes

Class Line # Actions
ComponentToken 28 10 0% 7 2
0.8823529588,2%
ComponentToken.Tag 34 0 - 0 0
-1.0 -
ComponentToken.Type 51 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 17 tests. .

Source view

1    /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing,
13    * software distributed under the License is distributed on an
14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15    * KIND, either express or implied. See the License for the
16    * specific language governing permissions and limitations
17    * under the License.
18    */
19    package org.devacfr.maven.skins.reflow.snippet;
20   
21    import com.google.common.base.MoreObjects;
22    import org.jsoup.nodes.Element;
23   
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    * type of snippet component
47    *
48    * @author Christophe Friederich
49    * @version 2.4
50    */
 
51    public enum Type {
52    /** web component */
53    webComponent,
54    /** shortcode component */
55    shortcode
56    }
57   
58    /** */
59    private final Element element;
60   
61    /** */
62    private final Tag tag;
63   
64    /** */
65    private final Type type;
66   
67    /** */
68    private final String name;
69   
70    /**
71    * @param tag
72    * @param type
73    */
 
74  64 toggle public ComponentToken(final Element element, final String name, final Tag tag, final Type type) {
75  64 this.element = element;
76  64 this.name = name;
77  64 this.tag = tag;
78  64 this.type = type;
79    }
80   
 
81  53 toggle public Element getElement() {
82  53 return element;
83    }
84   
 
85  11 toggle public String name() {
86  11 return name;
87    }
88   
 
89  93 toggle public Type type() {
90  93 return type;
91    }
92   
 
93  93 toggle public Tag tag() {
94  93 return tag;
95    }
96   
 
97  24 toggle public boolean isCloseTagOf(final ComponentToken startElement) {
98  24 return name.equals(startElement.name) && type.equals(startElement.type) && Tag.start.equals(startElement.tag)
99    && Tag.end.equals(tag);
100    }
101   
102    /**
103    * {@inheritDoc}
104    */
 
105  0 toggle @Override
106    public String toString() {
107  0 return MoreObjects.toStringHelper(this).add("name", name).add("type", type).add("tag", tag).toString();
108    }
109    }