Package com.karuslabs.elementary.file
Class FileObjects
java.lang.Object
com.karuslabs.elementary.file.FileObjects
Utilities for creating
JavaFileObjects.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JavaFileObject.KindDeduces the file extension of the given URI.static JavaFileObjectCreates aJavaFileObjectfrom a source file that the given fully qualified name represents, i.e.static JavaFileObjectCreates aJavaFileObjectusing the given fully qualified class name and source code.static JavaFileObjectCreates aJavaFileObjectusing the given fully qualified class name and source code.static JavaFileObjectCreates aJavaFileObjectusing the given fully qualified class name and source code.static JavaFileObjectofResource(String resource) Creates aJavaFileObjectfrom the given resource.static JavaFileObjectofResource(URL resource) Creates aJavaFileObjectfrom the given resource.static List<JavaFileObject>CreatesJavaFileObjects using the@Classpath,@Inline,@Introspectand@Resourceannotations on the given class.static List<JavaFileObject>scan(AnnotatedElement annotated) CreatesJavaFileObjects using the@Classpath,@Inlineand@Resourceannotations on the given element.
-
Field Details
-
DUMMY
A dummy Java source file.
-
-
Constructor Details
-
FileObjects
public FileObjects()
-
-
Method Details
-
scan
CreatesJavaFileObjects using the@Classpath,@Inline,@Introspectand@Resourceannotations on the given class.- Parameters:
annotated- the annotated class- Returns:
- the
JavaFileObjects
-
scan
CreatesJavaFileObjects using the@Classpath,@Inlineand@Resourceannotations on the given element.- Parameters:
annotated- the annotated element- Returns:
- the
JavaFileObjects
-
ofLines
Creates aJavaFileObjectusing the given fully qualified class name and source code. Each line is delimited by the system's line separator.- Parameters:
fullyQualifiedName- the fully qualified class namelines- the source code- Returns:
- a
JavaFileObject
-
ofLines
Creates aJavaFileObjectusing the given fully qualified class name and source code. Each line is delimited by the system's line separator.- Parameters:
fullyQualifiedName- the fully qualified class namelines- the source code- Returns:
- a
JavaFileObject
-
ofLines
Creates aJavaFileObjectusing the given fully qualified class name and source code.- Parameters:
fullyQualifiedName- the fully qualified class namesource- the source code- Returns:
- a
JavaFileObject
-
ofClass
Creates aJavaFileObjectfrom a source file that the given fully qualified name represents, i.e.my.package.MyClass.- Parameters:
fullyQualifiedName- the fully qualified name of a source file- Returns:
- a
JavaFileObject - Throws:
IllegalArgumentException- if the given class does not exist on the current clssspathUncheckedIOException- if the file could not be opened
-
ofResource
Creates aJavaFileObjectfrom the given resource. Directory names are separated via/. Resources must contain a valid file extension.- Parameters:
resource- the path to a resource, relative to the current ClassLoader- Returns:
- a
JavaFileObject - Throws:
IllegalArgumentException- if the given resource does not exist on the current clssspathUncheckedIOException- if the resource could not be opened
-
ofResource
Creates aJavaFileObjectfrom the given resource.- Parameters:
resource- the path to a resource, relative to the current ClassLoader- Returns:
- a
JavaFileObject - Throws:
IllegalArgumentException- if the given resource does not exist on the current clssspathUncheckedIOException- if the resource could not be opened
-
deduce
Deduces the file extension of the given URI.- Parameters:
uri- the URI- Returns:
- the file kind that the given URI represents
-