public abstract class AttributeFactory extends Object
AttributeImpl
s.Modifier and Type | Class and Description |
---|---|
static class |
AttributeFactory.StaticImplementationAttributeFactory<A extends AttributeImpl>
Expert: AttributeFactory returning an instance of the given
clazz for the
attributes it implements. |
Modifier and Type | Field and Description |
---|---|
static AttributeFactory |
DEFAULT_ATTRIBUTE_FACTORY
This is the default factory that creates
AttributeImpl s using the
class name of the supplied Attribute interface class by appending Impl to it. |
Constructor and Description |
---|
AttributeFactory() |
Modifier and Type | Method and Description |
---|---|
abstract AttributeImpl |
createAttributeInstance(Class<? extends Attribute> attClass)
Returns an
AttributeImpl for the supplied Attribute interface class. |
static <A extends AttributeImpl> |
getStaticImplementation(AttributeFactory delegate,
Class<A> clazz)
Returns an AttributeFactory returning an instance of the given
clazz for the
attributes it implements. |
public static final AttributeFactory DEFAULT_ATTRIBUTE_FACTORY
AttributeImpl
s using the
class name of the supplied Attribute
interface class by appending Impl
to it.public abstract AttributeImpl createAttributeInstance(Class<? extends Attribute> attClass) throws UndeclaredThrowableException
AttributeImpl
for the supplied Attribute
interface class.UndeclaredThrowableException
- A wrapper runtime exception thrown if the
constructor of the attribute class throws a checked exception.
Note that attributes should not throw or declare
checked exceptions; this may be verified and fail early in the future.public static <A extends AttributeImpl> AttributeFactory getStaticImplementation(AttributeFactory delegate, Class<A> clazz)
clazz
for the
attributes it implements. The given clazz
must have a public no-arg constructor.
For all other attributes it calls the given delegate factory as fallback.
This method can be used to prefer a specific AttributeImpl
which combines
multiple attributes over separate classes.
Please save instances created by this method in a static final field, because
on each call, this does reflection for creating a MethodHandle
.
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.