Class ResourcePackages

java.lang.Object
org.eclipse.lyo.oslc4j.provider.jena.ordfm.ResourcePackages

public class ResourcePackages extends Object
  • Method Details

    • mapPackage

      public 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.
      Parameters:
      pkg - the package to scan.
    • getClassOf

      public static Optional<Class<?>> getClassOf(Resource resource, Class<?>... preferredTypes)
      Gets the corresponding most concrete class (if any) of a resource's RDF.type.
      Parameters:
      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.
      Returns:
      an empty optional if there is not a mapped class for the given resource; it wrapped instance otherwise.
      Throws:
      IllegalStateException - if more than one class (not in the same inheritance tree) is annotated to be mapped by the same RDF:type.
    • reset

      public static void reset()
      Reset all package registration.
      Since:
      4.0.0.RC