StyleSheetEntry.java


Package: org.hammurapi

Results
Date2007/07/27
Codebase747
Reviews1351
DPMO118
Sigma5.176

Metrics
NameNumberMinAvgMaxTotal
Class complexity112.0012.0012.0012.00
Code length101.001.9010.0019.00
File length1146.00146.00146.00146.00
Operation complexity101.001.203.0012.00
Work order186.2086.2086.2086.20

Violations
#LineColumnNameSeverityDescription
1231ER-0233Packages should begin with []
213190ER-0363Line is too long
3421ER-0492Unify logging strategy - define individual logger for class
47129ER-0823Avoid using method parameter names that conflict with class member names
59429ER-0823Avoid using method parameter names that conflict with class member names
610328ER-0823Avoid using method parameter names that conflict with class member names
711835ER-0823Avoid using method parameter names that conflict with class member names

JavaDoc
StyleSheetEntry

1/*
2 * Hammurapi
3 * Automated Java code review system.
4 * Copyright (C) 2004 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.org
21 * e-Mail: support@hammurapi.biz
22 */

23package org.hammurapi;
24
25import java.io.File;
26import java.util.HashMap;
27import java.util.Iterator;
28import java.util.Map;
29
30import org.apache.tools.ant.Project;
31
32import com.pavelvlasov.ant.Param;
33import com.pavelvlasov.config.ConfigurationException;
34import com.pavelvlasov.config.Parameterizable;
35
36/**
37 * @author Pavel Vlasov
38 * @version $Revision: 1.2 $
39 * @ant.element parent="output" name="stylesheet" display-name="Stylesheet nested element of output"
40 * @ant.non-required
41 */

42public class StyleSheetEntry {
43
44 private String name;
45 private File file;
46 private String url;
47 private Map parameters=new HashMap();
48
49 /**
50 * @return
51 */

52 public String getName() {
53 return name;
54 }
55
56 /**
57 * Stylesheet 'logical' name. Supported names are:
58 * <UL>
59 * <LI>compilation-unit</LI>
60 * <LI>summary</LI>
61 * <LI>left-panel</LI>
62 * <LI>package</LI>
63 * <LI>inspector-set</LI>
64 * <LI>inspector-descriptor</LI>
65 * <LI>inspector-summary</LI>
66 * <LI>metric-details</LI>
67 * </UL>
68 * @return
69 * @ant.required
70 */

71 public void setName(String name) {
72 this.name=name;
73 }
74
75 /**
76 * @return
77 */

78 public File getFile() {
79 return file;
80 }
81
82 /**
83 * @return
84 */

85 public String getUrl() {
86 return url;
87 }
88
89 /**
90 * Stylesheet to use. Mutually exclusive with URL
91 * @param file
92 * @ant.non-required
93 */

94 public void setFile(File file) {
95 this.file=file;
96 }
97
98 /**
99 * URL to download stylesheet from. Mutually exclusive with File.
100 * @param url
101 * @ant.non-required
102 */

103 public void setUrl(String url) {
104 this.url=url;
105 }
106
107 /**
108 * @return
109 */

110 public Map getParameters() {
111 return parameters;
112 }
113
114 /**
115 * @param parameters
116 * @ant.ignore
117 */

118 public void setParameters(Map parameters) {
119 this.parameters.putAll(parameters);
120 }
121
122 /**
123 * Parameter which will be passed to transformer.
124 * @param param
125 * @ant.non-required
126 */

127 public void addConfiguredParameter(Param param) {
128 parameters.put(param.getName(), param);
129 }
130
131 void setParameters(Project project, Parameterizable p) throws ConfigurationException {
132 Iterator pit=parameters.values().iterator();
133 while (pit.hasNext()) {
134 Param param=(Param) pit.next();
135
136 param.setProject(project);
137 param.execute();
138
139 Object value=param.getObject(null);
140 if (value!=null) {
141 p.setParameter(param.getName(), value);
142 }
143 }
144 }
145}
146
147

Hammurapi 3 Copyright © 2004 Hammurapi Group. All Rights Reserved.