public abstract class AttributeFactory extends Object
Modifier | Constructor and Description |
---|---|
protected |
AttributeFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
addDatatype(String id,
AttributeProxy proxy)
Adds a proxy to the factory, which in turn will allow new attribute types to be created using
the factory.
|
abstract AttributeValue |
createValue(Node root)
Creates a value based on the given DOM root node.
|
abstract AttributeValue |
createValue(Node root,
String type)
Creates a value based on the given DOM root node and data type.
|
abstract AttributeValue |
createValue(Node root,
URI dataType)
Creates a value based on the given DOM root node and data type.
|
AttributeValue |
createValue(URI dataType,
String value)
Creates a value based on the given data type and text-encoded value.
|
abstract AttributeValue |
createValue(URI dataType,
String value,
String[] params)
Creates a value based on the given data type and text-encoded value.
|
static AttributeFactory |
getInstance()
Returns the default factory.
|
static AttributeFactory |
getInstance(String identifier)
Returns a factory based on the given identifier.
|
abstract Set |
getSupportedDatatypes()
Returns the datatype identifiers supported by this factory.
|
static void |
registerFactory(String identifier,
AttributeFactoryProxy proxy)
Registers the given factory proxy with the given identifier.
|
static void |
setDefaultFactory(AttributeFactoryProxy proxy)
Sets the default factory.
|
protected AttributeFactory()
public static final AttributeFactory getInstance()
AttributeFactory
public static final AttributeFactory getInstance(String identifier) throws UnknownIdentifierException
identifier
- the identifier for a factoryAttributeFactory
UnknownIdentifierException
- if the given identifier isn't registeredpublic static final void setDefaultFactory(AttributeFactoryProxy proxy)
proxy
- the AttributeFactoryProxy
to set as the new default factory proxypublic static final void registerFactory(String identifier, AttributeFactoryProxy proxy) throws IllegalArgumentException
identifier
- the identifier for the proxyproxy
- the AttributeFactoryProxy
to register with the given identifierIllegalArgumentException
- if the identifier is already usedpublic abstract void addDatatype(String id, AttributeProxy proxy)
AttributeValue
class.id
- the name of the attribute typeproxy
- the proxy used to create new attributes of the given typeIllegalArgumentException
- if the given id is already in usepublic abstract Set getSupportedDatatypes()
Set
of String
spublic abstract AttributeValue createValue(Node root) throws UnknownIdentifierException, ParsingException
DataType
, as is the case with the
AttributeValueType in the policy schema. The value is assumed to be the first child of this
node.root
- the DOM root of an attribute valueAttributeValue
UnknownIdentifierException
- if the type in the node isn't known to the factoryParsingException
- if the node is invalid or can't be parsed by the appropriate proxypublic abstract AttributeValue createValue(Node root, URI dataType) throws UnknownIdentifierException, ParsingException
root
- the DOM root of an attribute valuedataType
- the type of the attributeAttributeValue
UnknownIdentifierException
- if the data type isn't known to the factoryParsingException
- if the node is invalid or can't be parsed by the appropriate proxypublic abstract AttributeValue createValue(Node root, String type) throws UnknownIdentifierException, ParsingException
root
- the DOM root of an attribute valuetype
- the type of the attributeAttributeValue
UnknownIdentifierException
- if the type isn't known to the factoryParsingException
- if the node is invalid or can't be parsed by the appropriate proxypublic AttributeValue createValue(URI dataType, String value) throws UnknownIdentifierException, ParsingException
dataType
- the type of the attributevalue
- the text-encoded representation of an attribute's valueAttributeValue
UnknownIdentifierException
- if the data type isn't known to the factoryParsingException
- if the text is invalid or can't be parsed by the appropriate proxypublic abstract AttributeValue createValue(URI dataType, String value, String[] params) throws UnknownIdentifierException, ParsingException
dataType
- the type of the attributevalue
- the text-encoded representation of an attribute's valueparams
- additional parameters that need to creates a valueAttributeValue
UnknownIdentifierException
- if the data type isn't known to the factoryParsingException
- if the text is invalid or can't be parsed by the appropriate proxyCopyright © 2024 WSO2. All rights reserved.