01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.ext.awt.image.spi;
20:
21: import java.util.ArrayList;
22: import java.util.Collections;
23: import java.util.List;
24:
25: /**
26: *
27: * @version $Id: AbstractRegistryEntry.java 501094 2007-01-29 16:35:37Z deweese $
28: */
29: public abstract class AbstractRegistryEntry implements RegistryEntry,
30: ErrorConstants {
31:
32: String name;
33: float priority;
34: List exts;
35: List mimeTypes;
36:
37: public AbstractRegistryEntry(String name, float priority,
38: String[] exts, String[] mimeTypes) {
39: this .name = name;
40: this .priority = priority;
41:
42: this .exts = new ArrayList(exts.length);
43: for (int i = 0; i < exts.length; i++)
44: this .exts.add(exts[i]);
45: this .exts = Collections.unmodifiableList(this .exts);
46:
47: this .mimeTypes = new ArrayList(mimeTypes.length);
48: for (int i = 0; i < mimeTypes.length; i++)
49: this .mimeTypes.add(mimeTypes[i]);
50: this .mimeTypes = Collections.unmodifiableList(this .mimeTypes);
51: }
52:
53: public AbstractRegistryEntry(String name, float priority,
54: String ext, String mimeType) {
55: this .name = name;
56: this .priority = priority;
57:
58: this .exts = new ArrayList(1);
59: this .exts.add(ext);
60: this .exts = Collections.unmodifiableList(exts);
61:
62: this .mimeTypes = new ArrayList(1);
63: this .mimeTypes.add(mimeType);
64: this .mimeTypes = Collections.unmodifiableList(mimeTypes);
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: }
|