MCPcopy Create free account
hub / github.com/SquirrelJME/SquirrelJME / getProperty

Method getProperty

runt/apis/cldc-compact/java/lang/System.java:259–354  ·  view source on GitHub ↗

This obtains the value of a system property (if one is set) and returns its value. System properties are declared by the system and are used by applications to potentially modify their behavior. {@squirreljme.property java.io.tmpdir This is the temporary directory which indicates where temporary fi

(String __k)

Source from the content-addressed store, hash-verified

257 * @since 2016/05/21
258 */
259 public static String getProperty(String __k)
260 throws IllegalArgumentException, NullPointerException,
261 SecurityException
262 {
263 // Check
264 if (__k == null)
265 throw new NullPointerException("NARG");
266
267 // {@squirreljme.error ZZ1b Cannot request a system property which has
268 // a blank key.}
269 if (__k.equals(""))
270 throw new IllegalArgumentException("ZZ1b");
271
272 // Short circuit for run-time detection
273 if (__k.equals("cc.squirreljme.isruntime"))
274 return "true";
275
276 // Not allowed to do this?
277 getSecurityManager().checkPropertyAccess(__k);
278
279 // Depends on the property
280 switch (__k)
281 {
282 // API level of SquirrelJME
283 case "cc.squirreljme.apilevel":
284 return ApiLevel.levelToString(ApiLevel.CURRENT_LEVEL);
285
286 // SquirrelJME guest depth
287 case "cc.squirreljme.guests":
288 return Integer.toString(SystemProperties.guestDepth());
289
290 // SquirrelJME VM executable path
291 case "cc.squirreljme.vm.execpath":
292 return SystemProperties.executablePath();
293
294 // SquirrelJME free memory
295 case "cc.squirreljme.vm.freemem":
296 return Long.toString(Runtime.getRuntime().freeMemory());
297
298 // SquirrelJME total memory
299 case "cc.squirreljme.vm.totalmem":
300 return Long.toString(Runtime.getRuntime().totalMemory());
301
302 // SquirrelJME free memory
303 case "cc.squirreljme.vm.maxmem":
304 return Long.toString(Runtime.getRuntime().maxMemory());
305
306 // The version of the Java virtual machine (fixed value)
307 case "java.version":
308 return "1.8.0";
309
310 // The version of the JVM (full)
311 case "java.vm.version":
312 return SystemProperties.javaVMVersion();
313
314 // The name of the JVM
315 case "java.vm.name":
316 return SystemProperties.javaVMName();

Callers 15

mainMethod · 0.95
__detectToolsFlawMethod · 0.95
mainMethod · 0.95
ColorInfoClass · 0.95
systemPropertyMethod · 0.95
fromArgumentsMethod · 0.95
__parseInputMethod · 0.95
mainMethod · 0.95
__defaultPathsMethod · 0.95
__getPropertyPathMethod · 0.95
UIDisplayStateClass · 0.95
getAppPropertyMethod · 0.95

Calls 15

getSecurityManagerMethod · 0.95
levelToStringMethod · 0.95
toStringMethod · 0.95
guestDepthMethod · 0.95
executablePathMethod · 0.95
toStringMethod · 0.95
getRuntimeMethod · 0.95
javaVMVersionMethod · 0.95
javaVMNameMethod · 0.95
javaVMVendorMethod · 0.95
javaVMEmailMethod · 0.95
javaVMURLMethod · 0.95

Tested by 1

__parseInputMethod · 0.76