< prev index next >

src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java

Print this page




  69      */
  70     private AttributeSetUtilities() {
  71     }
  72 
  73     /**
  74      * Unmodifiable view of {@code AttributeSet}.
  75      *
  76      * @serial include
  77      */
  78     private static class UnmodifiableAttributeSet
  79         implements AttributeSet, Serializable {
  80 
  81         /**
  82          * Use serialVersionUID from JDK 1.4 for interoperability.
  83          */
  84         private static final long serialVersionUID = -6131802583863447813L;
  85 
  86         /**
  87          * The attribute set.
  88          */

  89         private AttributeSet attrset;
  90 
  91         /**
  92          * Constructs unmodifiable view of the underlying attribute set.
  93          *
  94          * @param  attributeSet the attribute set
  95          */
  96         public UnmodifiableAttributeSet(AttributeSet attributeSet) {
  97 
  98             attrset = attributeSet;
  99         }
 100 
 101         public Attribute get(Class<?> key) {
 102             return attrset.get(key);
 103         }
 104 
 105         public boolean add(Attribute attribute) {
 106             throw new UnmodifiableSetException();
 107         }
 108 


 329         }
 330         return new UnmodifiablePrintServiceAttributeSet (attributeSet);
 331     }
 332 
 333     /**
 334      * Synchronized view of {@code AttributeSet}.
 335      *
 336      * @serial include
 337      */
 338     private static class SynchronizedAttributeSet
 339                         implements AttributeSet, Serializable {
 340 
 341         /**
 342          * Use serialVersionUID from JDK 1.4 for interoperability.
 343          */
 344         private static final long serialVersionUID = 8365731020128564925L;
 345 
 346         /**
 347          * The attribute set.
 348          */

 349         private AttributeSet attrset;
 350 
 351         /**
 352          * Constructs a new synchronized attribute set.
 353          *
 354          * @param  attributeSet the attribute set
 355          */
 356         public SynchronizedAttributeSet(AttributeSet attributeSet) {
 357             attrset = attributeSet;
 358         }
 359 
 360         public synchronized Attribute get(Class<?> category) {
 361             return attrset.get(category);
 362         }
 363 
 364         public synchronized boolean add(Attribute attribute) {
 365             return attrset.add(attribute);
 366         }
 367 
 368         public synchronized boolean remove(Class<?> category) {




  69      */
  70     private AttributeSetUtilities() {
  71     }
  72 
  73     /**
  74      * Unmodifiable view of {@code AttributeSet}.
  75      *
  76      * @serial include
  77      */
  78     private static class UnmodifiableAttributeSet
  79         implements AttributeSet, Serializable {
  80 
  81         /**
  82          * Use serialVersionUID from JDK 1.4 for interoperability.
  83          */
  84         private static final long serialVersionUID = -6131802583863447813L;
  85 
  86         /**
  87          * The attribute set.
  88          */
  89         @SuppressWarnings("serial") // Not statically typed as Serializable
  90         private AttributeSet attrset;
  91 
  92         /**
  93          * Constructs unmodifiable view of the underlying attribute set.
  94          *
  95          * @param  attributeSet the attribute set
  96          */
  97         public UnmodifiableAttributeSet(AttributeSet attributeSet) {
  98 
  99             attrset = attributeSet;
 100         }
 101 
 102         public Attribute get(Class<?> key) {
 103             return attrset.get(key);
 104         }
 105 
 106         public boolean add(Attribute attribute) {
 107             throw new UnmodifiableSetException();
 108         }
 109 


 330         }
 331         return new UnmodifiablePrintServiceAttributeSet (attributeSet);
 332     }
 333 
 334     /**
 335      * Synchronized view of {@code AttributeSet}.
 336      *
 337      * @serial include
 338      */
 339     private static class SynchronizedAttributeSet
 340                         implements AttributeSet, Serializable {
 341 
 342         /**
 343          * Use serialVersionUID from JDK 1.4 for interoperability.
 344          */
 345         private static final long serialVersionUID = 8365731020128564925L;
 346 
 347         /**
 348          * The attribute set.
 349          */
 350         @SuppressWarnings("serial") // Not statically typed as Serializable
 351         private AttributeSet attrset;
 352 
 353         /**
 354          * Constructs a new synchronized attribute set.
 355          *
 356          * @param  attributeSet the attribute set
 357          */
 358         public SynchronizedAttributeSet(AttributeSet attributeSet) {
 359             attrset = attributeSet;
 360         }
 361 
 362         public synchronized Attribute get(Class<?> category) {
 363             return attrset.get(category);
 364         }
 365 
 366         public synchronized boolean add(Attribute attribute) {
 367             return attrset.add(attribute);
 368         }
 369 
 370         public synchronized boolean remove(Class<?> category) {


< prev index next >