PageRenderTime 58ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/jxr/maven-jxr/maven-jxr-java/src/main/java/org/apache/maven/jxr/java/src/JavaSrcOptions.java

https://github.com/apache/maven-sandbox
Java | 428 lines | 188 code | 54 blank | 186 comment | 10 complexity | 9ba1ea1d7ae8065bce74ddf19c8d7d74 MD5 | raw file
Possible License(s): Apache-2.0
  1. package org.apache.maven.jxr.java.src;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import java.lang.reflect.Field;
  21. import java.util.LinkedList;
  22. import java.util.List;
  23. /**
  24. * Bean with all options supported by <code>JavaSrc</code> class.
  25. *
  26. * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  27. * @version $Id$
  28. */
  29. public class JavaSrcOptions
  30. {
  31. /** Specifies the text to be placed at the bottom of each output file. */
  32. private String bottom;
  33. /** Output dir, required. */
  34. private String destDir;
  35. /** Specifies the encoding of the generated HTML files. */
  36. private String docencoding;
  37. /** Specifies the title to be placed near the top of the overview summary file. */
  38. private String doctitle;
  39. /** Source file encoding name. */
  40. private String encoding;
  41. /** Specifies the footer text to be placed at the bottom of each output file. */
  42. private String footer;
  43. /** Specifies the header text to be placed at the top of each output file. */
  44. private String header;
  45. /** Specifies the text for upper left frame. */
  46. private String packagesheader;
  47. /** Specify recursive pass, true by default. */
  48. private boolean recurse = true;
  49. /** List of source dir as String, required. */
  50. private List srcDirs;
  51. /** Specifies the path of an alternate HTML stylesheet file. */
  52. private String stylesheetfile;
  53. /** Specifies the top text to be placed at the top of each output file. */
  54. private String top;
  55. /** Specify verbose information */
  56. private boolean verbose;
  57. /** Specifies the title to be placed in the HTML title tag. */
  58. private String windowtitle;
  59. // TODO add no* options a la javadoc
  60. public JavaSrcOptions()
  61. {
  62. // nop
  63. }
  64. /**
  65. * @return all required and optional options
  66. */
  67. public static String getOptions()
  68. {
  69. StringBuffer sb = new StringBuffer();
  70. // Required options
  71. sb.append( "-DsrcDir=... " );
  72. sb.append( "-DdestDir=... " );
  73. sb.append( "\n" );
  74. // Optional options
  75. Field[] fields = JavaSrcOptions.class.getDeclaredFields();
  76. for ( int i = 0; i < fields.length; i++ )
  77. {
  78. String name = fields[i].getName();
  79. if ( ( name.indexOf( "class" ) != -1 ) || ( name.indexOf( "singleton" ) != -1 )
  80. || ( name.equals( "destDir" ) || name.equals( "srcDir" ) ) )
  81. {
  82. continue;
  83. }
  84. sb.append( " " );
  85. sb.append( "[-D" );
  86. sb.append( fields[i].getName() );
  87. sb.append( "=..." );
  88. sb.append( "]" );
  89. if ( ( i + 1 ) < fields.length - 1 )
  90. {
  91. sb.append( "\n" );
  92. }
  93. }
  94. return sb.toString();
  95. }
  96. /**
  97. * Getter for the bottom
  98. *
  99. * @return the bottom
  100. */
  101. public String getBottom()
  102. {
  103. return this.bottom;
  104. }
  105. /**
  106. * Getter for the destDir
  107. *
  108. * @return the destDir
  109. */
  110. public String getDestDir()
  111. {
  112. return this.destDir;
  113. }
  114. /**
  115. * Getter for the docencoding
  116. *
  117. * @return the docencoding
  118. */
  119. public String getDocencoding()
  120. {
  121. return this.docencoding;
  122. }
  123. /**
  124. * Getter for the doctitle
  125. *
  126. * @return the doctitle
  127. */
  128. public String getDoctitle()
  129. {
  130. return this.doctitle;
  131. }
  132. /**
  133. * Getter for the encoding
  134. *
  135. * @return the encoding
  136. */
  137. public String getEncoding()
  138. {
  139. return encoding;
  140. }
  141. /**
  142. * Getter for the footer
  143. *
  144. * @return the footer
  145. */
  146. public String getFooter()
  147. {
  148. return this.footer;
  149. }
  150. /**
  151. * Getter for the header
  152. *
  153. * @return the header
  154. */
  155. public String getHeader()
  156. {
  157. return this.header;
  158. }
  159. /**
  160. * Getter for the packagesheader
  161. *
  162. * @return the packagesheader
  163. */
  164. public String getPackagesheader()
  165. {
  166. return this.packagesheader;
  167. }
  168. /**
  169. * Getter for the String list of srcDir.
  170. *
  171. * @return the srcDir
  172. */
  173. public List getSrcDirs()
  174. {
  175. return srcDirs;
  176. }
  177. /**
  178. * Getter for the stylesheetfile
  179. *
  180. * @return the stylesheetfile
  181. */
  182. public String getStylesheetfile()
  183. {
  184. return this.stylesheetfile;
  185. }
  186. /**
  187. * Getter for the top
  188. *
  189. * @return the top
  190. */
  191. public String getTop()
  192. {
  193. return this.top;
  194. }
  195. /**
  196. * Getter for the windowtitle
  197. *
  198. * @return the windowtitle
  199. */
  200. public String getWindowtitle()
  201. {
  202. return this.windowtitle;
  203. }
  204. /**
  205. * Getter for the recurse
  206. *
  207. * @return the recurse
  208. */
  209. public boolean isRecurse()
  210. {
  211. return recurse;
  212. }
  213. /**
  214. * Getter for the verbose
  215. *
  216. * @return the verbose
  217. */
  218. public boolean isVerbose()
  219. {
  220. return verbose;
  221. }
  222. /**
  223. * Setter for the bottom
  224. *
  225. * @param bottom the bottom to set
  226. */
  227. public void setBottom( String bottom )
  228. {
  229. this.bottom = bottom;
  230. }
  231. /**
  232. * Setter for the destDir
  233. *
  234. * @param destDir the destDir to set
  235. */
  236. public void setDestDir( String destDir )
  237. {
  238. this.destDir = destDir;
  239. }
  240. /**
  241. * Setter for the docencoding
  242. *
  243. * @param docencoding the docencoding to set
  244. */
  245. public void setDocencoding( String docencoding )
  246. {
  247. this.docencoding = docencoding;
  248. }
  249. /**
  250. * Setter for the doctitle
  251. *
  252. * @param doctitle the doctitle to set
  253. */
  254. public void setDoctitle( String doctitle )
  255. {
  256. this.doctitle = doctitle;
  257. }
  258. /**
  259. * Setter for the encoding
  260. *
  261. * @param encoding the encoding to set
  262. */
  263. public void setEncoding( String encoding )
  264. {
  265. this.encoding = encoding;
  266. }
  267. /**
  268. * Setter for the footer
  269. *
  270. * @param footer the footer to set
  271. */
  272. public void setFooter( String footer )
  273. {
  274. this.footer = footer;
  275. }
  276. /**
  277. * Setter for the header
  278. *
  279. * @param header the header to set
  280. */
  281. public void setHeader( String header )
  282. {
  283. this.header = header;
  284. }
  285. /**
  286. * Setter for the packagesheader
  287. *
  288. * @param packagesheader the packagesheader to set
  289. */
  290. public void setPackagesheader( String packagesheader )
  291. {
  292. this.packagesheader = packagesheader;
  293. }
  294. /**
  295. * Setter for the recurse
  296. *
  297. * @param recurse the recurse to set
  298. */
  299. public void setRecurse( boolean recurse )
  300. {
  301. this.recurse = recurse;
  302. }
  303. /**
  304. * Adder for the srcDir
  305. *
  306. * @param srcDir the srcDir to set
  307. */
  308. public void addSrcDir( String srcDir )
  309. {
  310. if ( this.srcDirs == null )
  311. {
  312. this.srcDirs = new LinkedList();
  313. }
  314. this.srcDirs.add( srcDir );
  315. }
  316. /**
  317. * Setter for the stylesheetfile
  318. *
  319. * @param stylesheetfile the stylesheetfile to set
  320. */
  321. public void setStylesheetfile( String stylesheetfile )
  322. {
  323. this.stylesheetfile = stylesheetfile;
  324. }
  325. /**
  326. * Setter for the top
  327. *
  328. * @param top the top to set
  329. */
  330. public void setTop( String top )
  331. {
  332. this.top = top;
  333. }
  334. /**
  335. * Setter for the verbose
  336. *
  337. * @param verbose the verbose to set
  338. */
  339. public void setVerbose( boolean verbose )
  340. {
  341. this.verbose = verbose;
  342. }
  343. /**
  344. * Setter for the windowtitle
  345. *
  346. * @param windowtitle the windowtitle to set
  347. */
  348. public void setWindowtitle( String windowtitle )
  349. {
  350. this.windowtitle = windowtitle;
  351. }
  352. /** {@inheritDoc} */
  353. public String toString()
  354. {
  355. StringBuffer buffer = new StringBuffer();
  356. buffer.append( "Configuration[" );
  357. buffer.append( " bottom = " ).append( bottom );
  358. buffer.append( " destDir = " ).append( destDir );
  359. buffer.append( " docencoding = " ).append( docencoding );
  360. buffer.append( " doctitle = " ).append( doctitle );
  361. buffer.append( " encoding = " ).append( encoding );
  362. buffer.append( " footer = " ).append( footer );
  363. buffer.append( " header = " ).append( header );
  364. buffer.append( " packagesheader = " ).append( packagesheader );
  365. buffer.append( " recurse = " ).append( recurse );
  366. buffer.append( " srcDir = " ).append( srcDirs );
  367. buffer.append( " stylesheetfile = " ).append( stylesheetfile );
  368. buffer.append( " top = " ).append( top );
  369. buffer.append( " verbose = " ).append( verbose );
  370. buffer.append( " windowtitle = " ).append( windowtitle );
  371. buffer.append( "]" );
  372. return buffer.toString();
  373. }
  374. }