1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.velocity.internal.util

File VelocityBlock.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart3.png
80% of files have more coverage

Code metrics

0
6
5
2
108
34
5
0.83
1.2
2.5
1

Classes

Class Line # Actions
VelocityBlock 27 6 0% 5 8
0.2727272827.3%
VelocityBlock.VelocityType 34 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 3 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.velocity.internal.util;
21   
22    /**
23    * A Velocity element (can be a velocity macro, variable, etc.).
24    *
25    * @version $Id: fb8adae09fea6de500eb72421559372428abc0d6 $
26    */
 
27    public class VelocityBlock
28    {
29    /**
30    * The type of found Velocity element.
31    *
32    * @version $Id: fb8adae09fea6de500eb72421559372428abc0d6 $
33    */
 
34    public enum VelocityType
35    {
36    /**
37    * A simple or multilines comment.
38    */
39    COMMENT,
40   
41    /**
42    * A Velocity directive (except macros).
43    */
44    DIRECTIVE,
45   
46    /**
47    * A Velocity macro.
48    */
49    MACRO,
50   
51    /**
52    * Anything starting with a $.
53    */
54    VAR
55    }
56   
57    /**
58    * The name of the Velocity element (if, macro, ...).
59    */
60    private String name;
61   
62    /**
63    * The of the Velocity element.
64    */
65    private VelocityType type;
66   
67    /**
68    * @param name the name of the Velocity element (if, macro, ...).
69    * @param type the type of the Velocity element.
70    */
 
71  10 toggle public VelocityBlock(String name, VelocityType type)
72    {
73  10 this.name = name;
74  10 this.type = type;
75    }
76   
77    /**
78    * @return the name of the Velocity element (if, macro, ...).
79    */
 
80  0 toggle public String getName()
81    {
82  0 return this.name;
83    }
84   
85    /**
86    * @param name the name of the Velocity element (if, macro, ...).
87    */
 
88  0 toggle public void setName(String name)
89    {
90  0 this.name = name;
91    }
92   
93    /**
94    * @return the type of the Velocity element.
95    */
 
96  0 toggle public VelocityType getType()
97    {
98  0 return this.type;
99    }
100   
101    /**
102    * @param type the type of the Velocity element.
103    */
 
104  0 toggle public void setType(VelocityType type)
105    {
106  0 this.type = type;
107    }
108    }