| Home >> All >> javax >> ide >> model >> [ spi Javadoc ] |
Source code: javax/ide/model/spi/XMLDocTypeRecognizer.java
1 package javax.ide.model.spi; 2 3 import java.util.Collection; 4 import java.util.Collections; 5 import java.util.HashSet; 6 import javax.ide.util.MetaClass; 7 8 /** 9 * Information about how to recognize an XML document by its root element. 10 */ 11 public final class XMLDocTypeRecognizer extends SuffixRecognizer 12 { 13 private Collection _docTypes = new HashSet(); 14 15 public XMLDocTypeRecognizer( MetaClass documentClass ) 16 { 17 super( documentClass ); 18 } 19 20 public void addDocType( XMLDocType docType ) 21 { 22 _docTypes.add( docType ); 23 } 24 25 public Collection getSuffixes() 26 { 27 Collection suffixes = super.getSuffixes(); 28 if ( suffixes.isEmpty() ) 29 { 30 return Collections.singleton( ".xml" ); 31 } 32 return suffixes; 33 } 34 35 public Collection getDocTypes() 36 { 37 return Collections.unmodifiableCollection( _docTypes ); 38 } 39 }