%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jelly.util.TagUtils |
|
|
1 | /* |
|
2 | * Copyright 2002,2004 The Apache Software Foundation. |
|
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.apache.commons.jelly.util; |
|
17 | ||
18 | import org.apache.commons.jelly.Script; |
|
19 | import org.apache.commons.jelly.impl.CompositeTextScriptBlock; |
|
20 | import org.apache.commons.jelly.impl.ScriptBlock; |
|
21 | import org.apache.commons.jelly.impl.TextScript; |
|
22 | ||
23 | /** Contains static methods to help tag developers. |
|
24 | * @author Hans Gilde |
|
25 | * |
|
26 | */ |
|
27 | public class TagUtils { |
|
28 | 0 | private TagUtils() { |
29 | ||
30 | 0 | } |
31 | ||
32 | /** Trims the whitespace from a script and its children. |
|
33 | * |
|
34 | */ |
|
35 | public static void trimScript(Script body) { |
|
36 | 5109 | synchronized(body) { |
37 | 5109 | if ( body instanceof CompositeTextScriptBlock ) { |
38 | 65 | CompositeTextScriptBlock block = (CompositeTextScriptBlock) body; |
39 | 65 | block.trimWhitespace(); |
40 | 65 | } |
41 | else |
|
42 | 5044 | if ( body instanceof ScriptBlock ) { |
43 | 4225 | ScriptBlock block = (ScriptBlock) body; |
44 | 4225 | block.trimWhitespace(); |
45 | 4225 | } |
46 | 819 | else if ( body instanceof TextScript ) { |
47 | 299 | TextScript textScript = (TextScript) body; |
48 | 299 | textScript.trimWhitespace(); |
49 | } |
|
50 | 5109 | } |
51 | 5109 | } |
52 | ||
53 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |