lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.util.ImportUtil Class Reference

Utility class for handling package-related URIs in the context of LF (Lingua Franca) libraries. More...

Static Public Member Functions

static String buildPackageURI (String uriStr, Resource resource)
 Build a package URI based on the provided URI string and resource.
static Path buildPackageURIfromSrc (String uriStr, String root)
 Builds a package URI based on the provided URI string and source path.

Detailed Description

Utility class for handling package-related URIs in the context of LF (Lingua Franca) libraries.

This class provides methods to build URIs for accessing library files based on their location in a project structure, specifically targeting the "build/lfc_include" directory for library inclusion.

Member Function Documentation

◆ buildPackageURI()

String org.lflang.util.ImportUtil.buildPackageURI ( String uriStr,
Resource resource )
static

Build a package URI based on the provided URI string and resource.

This traverses upwards from the current resource URI until it finds the "src" directory, then constructs the final URI pointing to the library file within the "build/lfc_include" directory.

Parameters
uriStrA string representing the URI of the file. It must contain both the library name and file name, separated by a '/'.
resourceThe resource from which the URI resolution should start.
Returns
The constructed package URI as a string.
Exceptions
IllegalArgumentExceptionif the URI string does not contain both library and file names.

◆ buildPackageURIfromSrc()

Path org.lflang.util.ImportUtil.buildPackageURIfromSrc ( String uriStr,
String root )
static

Builds a package URI based on the provided URI string and source path.

This method works similarly to the buildPackageURI, but it accepts a direct source path instead of a resource. It traverses upwards to locate the "src/" directory and then constructs the URI pointing to the library file.

Parameters
uriStrA string representing the URI of the file. It must contain both the library name and file name, separated by a '/'.
rootThe root path from which the URI resolution should start.
Returns
The constructed package URI as a string.
Exceptions
IllegalArgumentExceptionif the URI string or source path is null, empty, or does not contain both the library name and file name.

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/util/ImportUtil.java