3232
3333package electrostatic4j .snaploader ;
3434
35+ import electrostatic4j .snaploader .filesystem .DirectoryPath ;
3536import electrostatic4j .snaploader .platform .NativeDynamicLibrary ;
3637
3738/**
5960 */
6061public final class LibraryInfo {
6162
62- private String jarPath ;
63- private String directory ;
63+ private DirectoryPath jarPath ;
64+ private DirectoryPath directory ;
6465 private String baseName ;
65- private String extractionDir ;
66+ private DirectoryPath directoryPath ;
6667
6768 /**
6869 * Instantiates a library info data structure pointing to a library in the classpath.
6970 *
7071 * @param directory the platform-independent directory inside the compression used for locating the native dynamic library,
7172 * this is used as a backup directory path
7273 * in case the {@link NativeDynamicLibrary#getPlatformDirectory()} is not valid.
73- * @param baseName the library basename, for example, 'lib-basename.so'.
74- * @param extractionDir the extraction destination in absolute string format, "null" if the current [user.dir] is
75- * specified as the extraction directory
74+ * @param baseName the library basename, for example, 'lib-basename.so' (not null).
75+ * @param directoryPath the extraction destination path, {@link DirectoryPath#USER_DIR} for
76+ * a user working directory extraction path,
77+ * and {@link DirectoryPath#USER_HOME} for the user home (not null).
7678 */
77- public LibraryInfo (String directory , String baseName , String extractionDir ) {
78- this (null , directory , baseName , extractionDir );
79+ public LibraryInfo (DirectoryPath directory , String baseName , DirectoryPath directoryPath ) {
80+ this (DirectoryPath . CLASS_PATH , directory , baseName , directoryPath );
7981 }
8082
8183 /**
8284 * Instantiates a library info data structure pointing to a library in an external jar with jarPath.
8385 *
84- * @param jarPath a path to an external jar to locate the library inside, "null" to use the project jar (classpath).
86+ * @param jarPath a path to an external jar to locate the library inside, {@link DirectoryPath#CLASS_PATH} to assign the classpath routine
87+ * to the {@link electrostatic4j.snaploader.filesystem.FileLocator} API (not null).
8588 * @param directory the platform-independent directory inside the compression used for locating the native dynamic library,
8689 * this is used as a backup directory path
8790 * in case the {@link NativeDynamicLibrary#getPlatformDirectory()} is not valid.
88- * @param baseName the library basename, for example, 'lib-basename.so'.
89- * @param extractionDir the extraction destination in absolute string format, "null" if the current [user.dir] is
90- * specified as the extraction directory
91+ * @param baseName the library basename, for example, 'lib-basename.so' (not null).
92+ * @param directoryPath the extraction destination path, {@link DirectoryPath#USER_DIR} for
93+ * a user working directory extraction path,
94+ * and {@link DirectoryPath#USER_HOME} for the user home (not null).
9195 */
92- public LibraryInfo (String jarPath , String directory , String baseName , String extractionDir ) {
96+ public LibraryInfo (DirectoryPath jarPath , DirectoryPath directory , String baseName , DirectoryPath directoryPath ) {
9397 this .jarPath = jarPath ;
9498 this .directory = directory ;
9599 this .baseName = baseName ;
96- this .extractionDir = extractionDir ;
100+ this .directoryPath = directoryPath ;
97101 }
98102
99103 /**
@@ -109,52 +113,48 @@ public String getBaseName() {
109113 * Retrieves the jar filesystem path, the jar is the compression used to locate the native dynamic library to
110114 * be extracted and loaded by {@link NativeBinaryLoader}.
111115 *
112- * @return the jar absolute filesystem path in a string format, "null" if the classpath is specified instead of
113- * an external jar compression
116+ * @return the jar absolute filesystem path object.
114117 */
115- public String getJarPath () {
118+ public DirectoryPath getJarPath () {
116119 return jarPath ;
117120 }
118121
119122 /**
120123 * Retrieves the directory inside the compression used for locating the native dynamic library.
121124 *
122- * @return the path to the dynamic library filesystem inside the compression, "null" if the
123- * default variant-based directories are set to be used
125+ * @return the path to the dynamic library filesystem inside the compression.
124126 */
125- public String getDirectory () {
127+ public DirectoryPath getDirectory () {
126128 return directory ;
127129 }
128130
129131 /**
130132 * Retrieves the extraction absolute directory.
131133 *
132- * @return the extraction destination in absolute string format, "null" if the current [user.dir] is
133- * specified as the extraction directory
134+ * @return the extraction destination path object.
134135 */
135- public String getExtractionDir () {
136- return extractionDir ;
136+ public DirectoryPath getExtractionDirectory () {
137+ return directoryPath ;
137138 }
138139
139140 /**
140141 * Sets the absolute path to the jar filesystem to locate the native dynamic library to be
141142 * extracted and loaded, "null" to use the "classpath (the stock jar)"" to load the library filesystem.
142143 *
143- * @param jarPath the absolute path to the jar filesystem to locate the library to be extracted, "null" to
144- * use the "classpath" (aka. the stock jar)
144+ * @param jarPath the external jar path object to localize the compression, use {@link DirectoryPath#CLASS_PATH}
145+ * to switch the file locator to the classpath routine.
145146 */
146- public void setJarPath (String jarPath ) {
147+ public void setJarPath (DirectoryPath jarPath ) {
147148 this .jarPath = jarPath ;
148149 }
149150
150151 /**
151152 * Sets the directory to the native dynamic library inside the jar compression, "null" to use
152153 * the default directories specified for each variant by {@link NativeBinaryLoader}.
153154 *
154- * @param directory the location to the native dynamic library inside the jar compression, "null"
155- * to use the default variant-based directories
155+ * @param directory the location to the native dynamic library inside the jar compression.
156156 */
157- public void setDirectory (String directory ) {
157+ public void setDirectory (DirectoryPath directory ) {
158158 this .directory = directory ;
159159 }
160160
@@ -168,13 +168,12 @@ public void setBaseName(final String baseName) {
168168 }
169169
170170 /**
171- * Sets the extraction directory used for extracting the native dynamic library in the
172- * form of an absolute directory, "null" to use the current [user.dir].
171+ * Sets the extraction directory used for extracting the native dynamic library.
173172 *
174- * @param extractionDir the absolute extraction directory to which the located library
175- * will be extracted to, "null" to set the extraction to the current [user.dir]
173+ * @param directoryPath the extraction directory path to which the native- located library
174+ * will be extracted to.
176175 */
177- public void setExtractionDir ( String extractionDir ) {
178- this .extractionDir = extractionDir ;
176+ public void setExtractionDirectory ( DirectoryPath directoryPath ) {
177+ this .directoryPath = directoryPath ;
179178 }
180179}
0 commit comments