Class AttributeSetUtilities provides static methods for manipulating
AttributeSets.
As mentioned in the package description of javax.print, a null reference
parameter to methods is
incorrect unless explicitly documented on the method as having a meaningful
interpretation. Usage to the contrary is incorrect coding and may result in
a run time exception either immediately
or at some later time. IllegalArgumentException and NullPointerException
are examples of typical and acceptable run time exceptions for such cases.
Method from javax.print.attribute.AttributeSetUtilities Detail: |
public static AttributeSet synchronizedView(AttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new SynchronizedAttributeSet(attributeSet);
}
Creates a synchronized view of the given attribute set. |
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new SynchronizedDocAttributeSet(attributeSet);
}
Creates a synchronized view of the given doc attribute set. |
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new SynchronizedPrintRequestAttributeSet(attributeSet);
}
Creates a synchronized view of the given print request attribute set. |
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new SynchronizedPrintJobAttributeSet(attributeSet);
}
Creates a synchronized view of the given print job attribute set. |
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new SynchronizedPrintServiceAttributeSet(attributeSet);
}
Creates a synchronized view of the given print service attribute set. |
public static AttributeSet unmodifiableView(AttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new UnmodifiableAttributeSet(attributeSet);
}
Creates an unmodifiable view of the given attribute set. |
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new UnmodifiableDocAttributeSet(attributeSet);
}
Creates an unmodifiable view of the given doc attribute set. |
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new UnmodifiablePrintRequestAttributeSet(attributeSet);
}
Creates an unmodifiable view of the given print request attribute set. |
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new UnmodifiablePrintJobAttributeSet(attributeSet);
}
Creates an unmodifiable view of the given print job attribute set. |
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet) {
if (attributeSet == null) {
throw new NullPointerException();
}
return new UnmodifiablePrintServiceAttributeSet (attributeSet);
}
Creates an unmodifiable view of the given print service attribute set. |
public static Class<?> verifyAttributeCategory(Object object,
Class<?> interfaceName) {
Class result = (Class) object;
if (interfaceName.isAssignableFrom (result)) {
return result;
}
else {
throw new ClassCastException();
}
}
Verify that the given object is a Class that
implements the given interface, which is assumed to be interface Attribute or a subinterface thereof. |
public static Attribute verifyAttributeValue(Object object,
Class<?> interfaceName) {
if (object == null) {
throw new NullPointerException();
}
else if (interfaceName.isInstance (object)) {
return (Attribute) object;
} else {
throw new ClassCastException();
}
}
Verify that the given object is an instance of the given interface, which
is assumed to be interface Attribute or a subinterface
thereof. |
public static void verifyCategoryForValue(Class<?> category,
Attribute attribute) {
if (!category.equals (attribute.getCategory())) {
throw new IllegalArgumentException();
}
}
Verify that the given attribute category object is equal to the
category of the given attribute value object. If so, this method
returns doing nothing. If not, this method throws an exception. |