public abstract class LiteralFactory extends Object
Note: this class uses the notion of "Convertor" (in the Exception naming),
but does not currently provide a mechanism to register such
Convertor
s. An implementation is said to provide
Convertor
s for the types it supports.
Constructor and Description |
---|
LiteralFactory() |
Modifier and Type | Method and Description |
---|---|
abstract <T> T |
createObject(Class<T> type,
Literal literal)
Converts a literal to an instance of the specified class
|
abstract Literal |
createTypedLiteral(Object value)
Create a typed literal for the specified object
|
static LiteralFactory |
getInstance()
Get a
LiteralFactory . |
static void |
setInstance(LiteralFactory instance)
Set the instance returned by
getInstance . |
public static LiteralFactory getInstance()
LiteralFactory
. If this has not been set using
setInstance it returns an instance of
org.apache.clerezza.model.impl.SimpleLiteralFactory
.LiteralFactory
public static void setInstance(LiteralFactory instance)
getInstance
.instance
- the new default LiteralFactory
public abstract Literal createTypedLiteral(Object value) throws NoConvertorException
value
- the value of the literal to be createdNoConvertorException
- thrown if value
is of an invalid typepublic abstract <T> T createObject(Class<T> type, Literal literal) throws NoConvertorException, InvalidLiteralTypeException
T
- type
- the Class
of the returned objectliteral
- the literal to be convertedNoConvertorException
- thrown if type
is unsupportedInvalidLiteralTypeException
- if the literal type doesn't match the requested java typeCopyright © 2015–2022 The Apache Software Foundation. All rights reserved.