1 package org.apache.maven.jxr.pacman;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.nio.file.Path;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.HashSet;
26 import java.util.List;
27 import java.util.Set;
28
29
30
31
32
33
34
35 public abstract class JavaFile
36 {
37 private Set<ImportType> imports = new HashSet<>();
38
39 private List<ClassType> classTypes = new ArrayList<>();
40
41 private PackageType packageType = new PackageType();
42
43 private final Path path;
44
45 private final String encoding;
46
47 protected JavaFile( Path path, String encoding )
48 {
49 this.path = path;
50 this.encoding = encoding;
51 }
52
53
54
55
56 public Set<ImportType> getImportTypes()
57 {
58 return Collections.unmodifiableSet( imports );
59 }
60
61
62
63
64 public ClassType getClassType()
65 {
66 if ( classTypes.isEmpty() )
67 {
68 return null;
69 }
70 else
71 {
72
73 return this.classTypes.get( 0 );
74 }
75 }
76
77
78
79
80 public List<ClassType> getClassTypes()
81 {
82 return this.classTypes;
83 }
84
85
86
87
88 public PackageType getPackageType()
89 {
90 return this.packageType;
91 }
92
93
94
95
96
97 public void addClassType( ClassType classType )
98 {
99 this.classTypes.add( classType );
100 }
101
102
103
104
105 public void addImportType( ImportType importType )
106 {
107 this.imports.add( importType );
108 }
109
110
111
112
113 public void setClassType( ClassType classType )
114 {
115
116 this.classTypes.clear();
117 this.classTypes.add( classType );
118 }
119
120
121
122
123 public void setPackageType( PackageType packageType )
124 {
125 this.packageType = packageType;
126 }
127
128
129
130
131
132 public Path getPath()
133 {
134 return this.path;
135 }
136
137
138
139
140 public String getEncoding()
141 {
142 return this.encoding;
143 }
144 }