1 19 20 package org.netbeans.modules.xml.retriever; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import org.netbeans.modules.xml.retriever.catalog.Utilities.DocumentTypesEnum; 25 26 30 public class DocumentParserFactory { 31 32 private static ArrayList <DocumentTypeParser> registereDocumentTypeParsers = new ArrayList <DocumentTypeParser>(); 33 34 static{ 35 registereDocumentTypeParsers.add(new DocumentTypeSchemaWsdlParser()); 36 } 37 38 public static DocumentTypeParser getParser(DocumentTypesEnum docType){ 39 for(DocumentTypeParser dParser: registereDocumentTypeParsers){ 40 if(dParser.accept(docType.toString())) 41 return dParser; 42 } 43 return null; 44 } 45 46 public static List <DocumentTypeParser>getRegisteredParsers(){ 47 return (List <DocumentTypeParser>) registereDocumentTypeParsers; 48 } 49 50 public static boolean removeRegisteredParser(DocumentTypeParser oldDocumentTypeParser){ 51 return registereDocumentTypeParsers.remove(oldDocumentTypeParser); 52 } 53 54 public static void addParser(DocumentTypeParser newDocumentTypeParser){ 55 registereDocumentTypeParsers.add(newDocumentTypeParser); 56 } 57 58 } 59 | Popular Tags |