public final class ModelUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Comparator<Representation> |
RESULT_SCORE_COMPARATOR
Comparator based on the
RdfResourceEnum.resultScore property that
assumes that values of this property implement Comparable. |
| Modifier and Type | Method and Description |
|---|---|
static <T> Collection<T> |
addToCollection(Iterator<? extends T> it,
Collection<T> c)
Adds the elements of the
Iterator to the parsed Collection |
static <T> Set<T> |
addToSet(Iterator<? extends T> it,
Set<T> set)
|
static <T> Collection<T> |
asCollection(Iterator<? extends T> it)
Copies all elements of the parsed Iterator to a
ArrayList. |
static <T> Set<T> |
asSet(Iterator<? extends T> it)
Copies all elements of the parsed Iterator to a
HashSet. |
static void |
checkValues(ValueFactory valueFactory,
Object value,
Collection<Object> results)
Processes a value parsed as object to the representation.
|
static String |
getAboutRepresentation(Representation metadata)
|
static String[] |
getNamespaceLocalName(String uri)
Splits up a URI in local name and namespace based on the following rules
If URI starts with "urn:" and last index of ':' == 3 than the there
is no namespace and the whole URI is a local name
if the uri starts with "urn:" and the last index of ':' ia > 3, than
the last index ':' is used.
|
static QName |
getQName(String uri)
This Method uses
getNamespaceLocalName(String) to split up
namespace and local name. |
static String |
getRepresentationInfo(Representation rep)
String representation of the parsed Representation inteded for DEBUG level
loggings.
|
static UUID |
randomUUID()
TODO: Maybe we need a better way to generate unique IDs
|
static void |
setSeed(long seed) |
public static final Comparator<Representation> RESULT_SCORE_COMPARATOR
RdfResourceEnum.resultScore property that
assumes that values of this property implement Comparable. The
Representation with the highest score will be firstpublic static UUID randomUUID()
public static void setSeed(long seed)
public static void checkValues(ValueFactory valueFactory, Object value, Collection<Object> results)
null values
Reference
Text (the second entry is used as language.
Further entries are ignored.
Iterable (any Array or
Collection), Iterator or Enumeration is parsed.
IllegalArgumentException
in case any of the parsed values is invalid. Currently invalid values are
just ignored.value - the value to parseresults - the collections the results of the parsing are added to.public static String getRepresentationInfo(Representation rep)
rep - the representationpublic static <T> Collection<T> asCollection(Iterator<? extends T> it)
ArrayList.
To use other Set implementations that ArrayList you can use
{@link #addToCollection(Iterator, Collection)T - the generic type of the returned Collectionit - the Iterator with elements compatible to TIllegalArgumentException - if the parsed Iterator is nullpublic static <T> Collection<T> addToCollection(Iterator<? extends T> it, Collection<T> c)
Iterator to the parsed CollectionT - the type of the collectionit - the iterator over elements that are compatible to Tc - the collection to add the elementsIllegalArgumentException - if the parsed Collection is null.public static <T> Set<T> asSet(Iterator<? extends T> it)
HashSet.
To use other Set implementations that HashSet you can use
addToSet(Iterator, Set)T - the generic type of the returned setit - the Iterator with elements compatible to TIllegalArgumentException - if the parsed Iterator is nullpublic static <T> Set<T> addToSet(Iterator<? extends T> it, Set<T> set)
T - the type of the setit - the iterator over elements that are compatible to Tset - the set to add the elementsSet with the added ElementsIllegalArgumentException - if the parsed Set is null.public static String[] getNamespaceLocalName(String uri)
uri - The urinull. In the second the local name is stored.public static QName getQName(String uri)
getNamespaceLocalName(String) to split up
namespace and local name. It uses also the Data in the
NamespaceEnum to retrieve prefixes for Namespaces.uri - the URIpublic static String getAboutRepresentation(Representation metadata) throws IllegalStateException
metadata - the metadatanull if the parsed Representation
is null or does not define a value for
RdfResourceEnum.aboutRepresentationIllegalStateExceptionCopyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.