returns the string with the interfaces that implement the main class and the class that extends it
(String typeResource, Set<String> interfacesList)
| 149 | * the class that extends it |
| 150 | */ |
| 151 | public String getInterfacesAndClass (String typeResource, Set<String> interfacesList) |
| 152 | throws ClassNotFoundException { |
| 153 | |
| 154 | String abstractClass = null; |
| 155 | // add the class that it extends |
| 156 | String interfacesAndClass = null; |
| 157 | // the class corresponding to the current interface from list interfaces. |
| 158 | Class<?> currentClass = null; |
| 159 | |
| 160 | // determine the abstract class |
| 161 | if (typeResource.equals("ProcessingResource")) { |
| 162 | abstractClass = "AbstractProcessingResource"; |
| 163 | } else if (typeResource.equals("VisualResource")) { |
| 164 | abstractClass = "AbstractVisualResource"; |
| 165 | } else if (typeResource.equals("LanguageResource")) { |
| 166 | abstractClass = "AbstractLanguageResource";} |
| 167 | |
| 168 | interfacesAndClass = " extends " + abstractClass; |
| 169 | |
| 170 | // a map from all the methods from interfaces to the lists which contains |
| 171 | // the features of every method |
| 172 | List<FeatureMethod> methodsInterfaces = new ArrayList<FeatureMethod>(); |
| 173 | if (interfacesList!=null) { |
| 174 | interfacesAndClass = interfacesAndClass+ newLine+ " implements "; |
| 175 | Iterator<String> iter = interfacesList.iterator(); |
| 176 | while (iter.hasNext()) { |
| 177 | String nameInterface = iter.next(); |
| 178 | String nameClass = null; |
| 179 | int index = nameInterface.lastIndexOf("."); |
| 180 | if (index != -1) { |
| 181 | currentClass = Class.forName(nameInterface); |
| 182 | nameClass = nameInterface.substring(index+1,nameInterface.length()); |
| 183 | } else { |
| 184 | nameClass = nameInterface; |
| 185 | currentClass = Class.forName("gate."+nameInterface); |
| 186 | }// else |
| 187 | |
| 188 | // add the package to the list |
| 189 | allPackages.add(currentClass.getPackage().getName()+".*"); |
| 190 | |
| 191 | interfacesAndClass = interfacesAndClass + nameClass + ", "; |
| 192 | |
| 193 | methodsInterfaces = featuresClass(currentClass,methodsInterfaces); |
| 194 | }//while |
| 195 | }// if |
| 196 | |
| 197 | // add the abstract class |
| 198 | if (interfacesList == null || !interfacesList.contains("gate."+typeResource)) |
| 199 | interfacesAndClass = interfacesAndClass + typeResource; |
| 200 | else if (interfacesAndClass.endsWith(", ")) |
| 201 | interfacesAndClass = interfacesAndClass.substring |
| 202 | (0,interfacesAndClass.length()-2); |
| 203 | |
| 204 | // methods from the class that extends the resource |
| 205 | List<FeatureMethod> methodsClassExtend = new ArrayList<FeatureMethod>(); |
| 206 | Class<?> currentClassExtend = Class.forName("gate.creole."+abstractClass); |
| 207 | methodsClassExtend = featuresClass(currentClassExtend, methodsClassExtend); |
| 208 |
no test coverage detected