+
+
+
+ ognl¶
+++Execute ognl expression.
Since 3.0.5.
+
+
+
+
+Parameters¶
+Name | +Specification | +
---|---|
express | +expression to be executed | +
[c:] |
+The hashcode of the ClassLoader that executes the expression, default ClassLoader is SystemClassLoader. | +
[x] | +Expand level of object (1 by default). | +
+
+
+
+
+
+
+
+Usage¶
+
+
+
+Call static method:
+$ ognl '@java.lang.System@out.println("hello")'
+null
+
Get static field:
+$ ognl '@demo.MathGame@random'
+@Random[
+ serialVersionUID=@Long[3905348978240129619],
+ seed=@AtomicLong[125451474443703],
+ multiplier=@Long[25214903917],
+ addend=@Long[11],
+ mask=@Long[281474976710655],
+ DOUBLE_UNIT=@Double[1.1102230246251565E-16],
+ BadBound=@String[bound must be positive],
+ BadRange=@String[bound must be greater than origin],
+ BadSize=@String[size must be non-negative],
+ seedUniquifier=@AtomicLong[-3282039941672302964],
+ nextNextGaussian=@Double[0.0],
+ haveNextNextGaussian=@Boolean[false],
+ serialPersistentFields=@ObjectStreamField[][isEmpty=false;size=3],
+ unsafe=@Unsafe[sun.misc.Unsafe@28ea5898],
+ seedOffset=@Long[24],
+]
+
Execute a multi-line expression, and return a list:
+$ ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
+@ArrayList[
+ @String[/opt/java/8.0.181-zulu/jre],
+ @String[OpenJDK Runtime Environment],
+]
+