KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > pdf > PDFAMode


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 /* $Id$ */
19
20 package org.apache.fop.pdf;
21
22 /** Enum class for PDF/A modes. */
23 public final class PDFAMode {
24
25     /** PDF/A disabled */
26     public static final PDFAMode DISABLED = new PDFAMode("PDF/A disabled");
27     /** PDF/A-1a enabled */
28     public static final PDFAMode PDFA_1A = new PDFAMode("PDF/A-1a");
29     /** PDF/A-1b enabled */
30     public static final PDFAMode PDFA_1B = new PDFAMode("PDF/A-1b");
31     
32     private String JavaDoc name;
33
34     /**
35      * Constructor to add a new named item.
36      * @param name Name of the item.
37      */

38     private PDFAMode(String JavaDoc name) {
39         this.name = name;
40     }
41
42     /** @return the name of the enum */
43     public String JavaDoc getName() {
44         return this.name;
45     }
46     
47     /** @return true if this mode obey the restrictions established by PDF/A-1b. */
48     public boolean isPDFA1LevelB() {
49         return (this != DISABLED);
50         //PDF/A-1a is a superset of PDF/A-1b!
51
}
52     
53     /**
54      * Returns the mode enum object given a String.
55      * @param s the string
56      * @return the PDFAMode enum object (DISABLED will be returned if no match is found)
57      */

58     public static PDFAMode valueOf(String JavaDoc s) {
59         if (PDFA_1A.getName().equalsIgnoreCase(s)) {
60             return PDFA_1A;
61         } else if (PDFA_1B.getName().equalsIgnoreCase(s)) {
62             return PDFA_1B;
63         } else {
64             return DISABLED;
65         }
66     }
67     
68     /** @see java.lang.Object#toString() */
69     public String JavaDoc toString() {
70         return name;
71     }
72     
73 }
74
Popular Tags