public class AttributeFactory extends Object
Modifier and Type | Method and Description |
---|---|
boolean |
isKnownType(String typeName)
Return true if this factory has a creator register to handle
the
typeName attribute type, so that calling
newAttribute(java.lang.String) with the same typeName
should succeed. |
Attribute |
newAttribute(String typeName)
Creates a new attribute for which
Attribute.typeName() matches
the typeName argument, using one of the registered instances of
AttributeFactory . |
static Attribute.AttributeCreator |
newDefaultCreator(Class<? extends Attribute> cls)
Creates a new instance of an anonymous creator which creates a new
instance using the default constructor through reflection.
|
static AttributeFactory |
newDefaultFactory()
Creates a new instance of an
AttributeFactory which handles
the default known attribute types for OpenEXR 1.7.1 image files. |
void |
registerAttributeType(String typeName,
Attribute.AttributeCreator creator)
Register a new attribute creator which will be used when
newAttribute(java.lang.String) is called with the type name
typeName . |
public Attribute newAttribute(String typeName) throws IllegalArgumentException
Attribute.typeName()
matches
the typeName
argument, using one of the registered instances of
AttributeFactory
. If the type name is not know it throws
IllegalArgumentException
.typeName
- the name representing the type of the desired attribute.IllegalArgumentException
- if the type is not known.registerAttributeType(java.lang.String, edu.cornell.graphics.exr.attributes.Attribute.AttributeCreator)
public boolean isKnownType(String typeName)
typeName
attribute type, so that calling
newAttribute(java.lang.String)
with the same typeName
should succeed.typeName
- the type name whose presence in the factory is tested.public void registerAttributeType(String typeName, Attribute.AttributeCreator creator) throws IllegalArgumentException
newAttribute(java.lang.String)
is called with the type name
typeName
. If there is already a handler registered for the
attribute type it throws IllegalArgumentException
.typeName
- the type name associated with the creator instance.creator
- the instance which will create attributes of the
specified type.IllegalArgumentException
- if there is already a handler for the
specified attribute type.public static Attribute.AttributeCreator newDefaultCreator(Class<? extends Attribute> cls)
cls
- the class of an Attribute
which provides a public
default constructor.public static AttributeFactory newDefaultFactory()
AttributeFactory
which handles
the default known attribute types for OpenEXR 1.7.1 image files. The
returned factory instance may be further modified by the clients.AttributeFactory
which handles the
default OpenEXR 1.7.1 attribute types.