1 package org.apache.maven.doxia.parser.module;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 /**
23 * An abstract base class that implements the ParserModule interface.
24 *
25 * @since 1.6
26 */
27 public abstract class AbstractParserModule
28 implements ParserModule
29 {
30 /** The source directory. */
31 private final String sourceDirectory;
32
33 /** The default file extension. */
34 private final String extension;
35
36 /** The default file extension. */
37 private final String parserId;
38
39 /**
40 * Constructor with null.
41 */
42 public AbstractParserModule()
43 {
44 this( null, null, null );
45 }
46
47 /**
48 * Constructor with same value for everything: source directory and file extension equal parserId.
49 */
50 public AbstractParserModule( String parserId )
51 {
52 this( parserId, parserId, parserId );
53 }
54
55 /**
56 * Constructor with same value for parser id and source directory.
57 */
58 public AbstractParserModule( String parserId, String extension )
59 {
60 this( parserId, extension, parserId );
61 }
62
63 /**
64 * @param sourceDirectory not null
65 * @param extension not null
66 * @param parserId not null
67 * @since 1.1.1
68 */
69 protected AbstractParserModule( String sourceDirectory, String extension, String parserId )
70 {
71 super();
72 this.sourceDirectory = sourceDirectory;
73 this.extension = extension;
74 this.parserId = parserId;
75 }
76
77 /** {@inheritDoc} */
78 public String getSourceDirectory()
79 {
80 return sourceDirectory;
81 }
82
83 /** {@inheritDoc} */
84 public String getExtension()
85 {
86 return extension;
87 }
88
89 /** {@inheritDoc} */
90 public String getParserId()
91 {
92 return parserId;
93 }
94 }