public class ResourcePackages extends Object
Constructor and Description |
---|
ResourcePackages() |
Modifier and Type | Method and Description |
---|---|
static Optional<Class<?>> |
getClassOf(org.apache.jena.rdf.model.Resource resource,
Class<?>... preferredTypes)
Gets the corresponding most concrete class (if any) of a
resource 's RDF.type . |
static void |
mapPackage(Package pkg)
Scans a package (recursively) searching for classes annotated with
OslcResourceShape and mapping them with an RDF.type built
by the TypeFactory.getQualifiedName(java.lang.Class) method. |
public static void mapPackage(Package pkg)
OslcResourceShape
and mapping them with an RDF.type
built
by the TypeFactory.getQualifiedName(java.lang.Class)
method.pkg
- the package to scan.public static Optional<Class<?>> getClassOf(org.apache.jena.rdf.model.Resource resource, Class<?>... preferredTypes)
resource
's RDF.type
.resource
- the resource to resolve its type.preferredTypes
- sometimes, the same RDF type is mapped by more than
one class, in such cases this parameter indicates the preferred type to
return in priority order. Avoid to use abstract types here.IllegalStateException
- if more than one class (not in the same
inheritance tree) is annotated to be mapped by the same RDF:type
.Copyright © 2020. All rights reserved.