1 28 package net.sf.jasperreports.engine.util; 29 30 import java.io.InvalidObjectException ; 31 import java.text.AttributedCharacterIterator ; 32 import java.util.HashMap ; 33 import java.util.Map ; 34 35 36 40 public final class JRTextAttribute extends AttributedCharacterIterator.Attribute 41 { 42 43 private static final Map instanceMap = new HashMap (4); 44 45 48 public static JRTextAttribute PDF_FONT_NAME = new JRTextAttribute("PDF_FONT_NAME"); 49 public static JRTextAttribute PDF_ENCODING = new JRTextAttribute("PDF_ENCODING"); 50 public static JRTextAttribute IS_PDF_EMBEDDED = new JRTextAttribute("IS_PDF_EMBEDDED"); 51 public static JRTextAttribute HTML_FONT_FACE = new JRTextAttribute("HTML_FONT_FACE"); 52 53 56 private JRTextAttribute(String name) 57 { 58 super(name); 59 60 if (this.getClass() == JRTextAttribute.class) 61 { 62 instanceMap.put(name, this); 63 } 64 } 65 66 69 protected Object readResolve() throws InvalidObjectException 70 { 71 if (this.getClass() != JRTextAttribute.class) 72 { 73 throw new InvalidObjectException ("Subclass didn't correctly implement readResolve"); 74 } 75 76 JRTextAttribute instance = (JRTextAttribute) instanceMap.get(getName()); 77 if (instance != null) 78 { 79 return instance; 80 } 81 82 throw new InvalidObjectException ("Unknown attribute name"); 83 } 84 85 } 86 | Popular Tags |