1 18 package org.apache.batik.ext.awt.image.spi; 19 20 import java.util.ArrayList ; 21 import java.util.Collections ; 22 import java.util.List ; 23 24 public abstract class AbstractRegistryEntry 25 implements RegistryEntry, ErrorConstants { 26 27 String name; 28 float priority; 29 List exts; 30 List mimeTypes; 31 32 public AbstractRegistryEntry(String name, 33 float priority, 34 String [] exts, 35 String [] mimeTypes) { 36 this.name = name; 37 this.priority = priority; 38 39 this.exts = new ArrayList (exts.length); 40 for (int i=0; i<exts.length; i++) 41 this.exts.add(exts[i]); 42 this.exts = Collections.unmodifiableList(this.exts); 43 44 this.mimeTypes = new ArrayList (mimeTypes.length); 45 for (int i=0; i<mimeTypes.length; i++) 46 this.mimeTypes.add(mimeTypes[i]); 47 this.mimeTypes = Collections.unmodifiableList(this.mimeTypes); 48 } 49 50 public AbstractRegistryEntry(String name, 51 float priority, 52 String ext, 53 String mimeType) { 54 this.name = name; 55 this.priority = priority; 56 57 this.exts = new ArrayList (1); 58 this.exts.add(ext); 59 this.exts = Collections.unmodifiableList(exts); 60 61 this.mimeTypes = new ArrayList (1); 62 this.mimeTypes.add(mimeType); 63 this.mimeTypes = Collections.unmodifiableList(mimeTypes); 64 } 65 66 67 public String getFormatName() { 68 return name; 69 } 70 71 public List getStandardExtensions() { 72 return exts; 73 } 74 75 public List getMimeTypes() { 76 return mimeTypes; 77 } 78 79 public float getPriority() { 80 return priority; 81 } 82 } 83 | Popular Tags |