KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > ext > awt > image > spi > AbstractRegistryEntry


1 /*
2
3    Copyright 2001,2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

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