org.apache.stanbol.entityhub.servicesapi.model
Interface ValueFactory


public interface ValueFactory

FactoryInterface for Text and Reference instances TODO: Still not sure if we need that

Author:
Rupert Westenthaler

Method Summary
 Reference createReference(Object value)
          Creates a reference instance for the parsed value.
 Representation createRepresentation(String id)
          Creates an empty representation instance of with the type SignTypeEnum#Sign for the parsed ID.
 Text createText(Object value)
          Creates a Text instance without an language
 Text createText(String text, String language)
          Creates a Text instance for a language
 

Method Detail

createText

Text createText(Object value)
                throws UnsupportedTypeException,
                       IllegalArgumentException
Creates a Text instance without an language

Parameters:
value - The value if the text. Implementations might support special support for specific classes. As an default the Object.toString() method is used to get the lexical form of the text from the parsed value and null should be used as language.
Returns:
the Text instance for the parsed object
Throws:
UnsupportedTypeException - if the type of the parsed object is not can not be used to create Text instances
IllegalArgumentException - If null is parsed or if the parsed instance type is supported, but the parsed instance can not be used to create a text instance

createText

Text createText(String text,
                String language)
                throws IllegalArgumentException
Creates a Text instance for a language

Parameters:
text - the text
language - the language or null.
Returns:
the Text instance
Throws:
IllegalArgumentException - if null is parsed as text or if the parsed parameter can not be used to create a Text instance

createReference

Reference createReference(Object value)
                          throws UnsupportedTypeException,
                                 IllegalArgumentException
Creates a reference instance for the parsed value. Implementations might support special support for specific classes. As an default the Object.toString() method is used to get the unicode representation of the reference.

Implementation MUST support at least the following types:

Parameters:
value - the unicode representation of the reference
Returns:
the reference instance
Throws:
UnsupportedTypeException - if the type of the parsed object can not be converted to a Reference.
IllegalArgumentException - if the parsed value is null or if the parsed value can not be used to create a valid Reference (e.g. when parsing an empty String)

createRepresentation

Representation createRepresentation(String id)
                                    throws IllegalArgumentException
Creates an empty representation instance of with the type SignTypeEnum#Sign for the parsed ID. The id MUST not be null nor empty

Parameters:
id - The id of the representation
Returns:
the representation
Throws:
IllegalArgumentException - if null or an empty string is parsed as ID


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.