01: package de.java2html.converter;
02:
03: import java.util.ArrayList;
04: import java.util.List;
05:
06: /**
07: * @author Markus Gebhard
08: */
09: public class JavaSourceConverterProvider {
10:
11: private final static List/*<IJavaSourceConverter>*/converters = new ArrayList() {
12: {
13: add(new JavaSource2HTMLConverter());
14: add(new JavaSource2Xhtml11Converter());
15: add(new JavaSource2XhtmlConverter());
16: add(new JavaSource2TeXConverter());
17: add(new JavaSource2RtfConverter());
18: add(new JavaSource2XmlConverter());
19: }
20: };
21:
22: public static String getDefaultConverterName() {
23: return ((IJavaSourceConverter) converters.get(0)).getMetaData()
24: .getName().toLowerCase();
25: }
26:
27: public static IJavaSourceConverter getJavaSourceConverterByName(
28: String name) {
29: for (int i = 0; i < converters.size(); ++i) {
30: final IJavaSourceConverter converter = (IJavaSourceConverter) converters
31: .get(i);
32: if ((converter).getMetaData().getName().equalsIgnoreCase(
33: name)) {
34: return converter;
35: }
36: }
37: return null;
38: }
39:
40: /** @see #getAllConverters() */
41: public static String[] getAllConverterNames() {
42: String[] names = new String[converters.size()];
43: for (int i = 0; i < names.length; ++i) {
44: names[i] = ((IJavaSourceConverter) converters.get(i))
45: .getMetaData().getName();
46: }
47: return names;
48: }
49:
50: public static IJavaSourceConverter[] getAllConverters() {
51: return (IJavaSourceConverter[]) converters
52: .toArray(new IJavaSourceConverter[converters.size()]);
53: }
54:
55: public static String[] getAllConverterPrintNames() {
56: String[] printNames = new String[converters.size()];
57: for (int i = 0; i < printNames.length; ++i) {
58: printNames[i] = ((IJavaSourceConverter) converters.get(i))
59: .getMetaData().getPrintName();
60: }
61: return printNames;
62: }
63: }
|