net.bytebuddy.utility.privilege.GetSystemPropertyAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of byte-buddy-dep Show documentation
Show all versions of byte-buddy-dep Show documentation
Byte Buddy is a Java library for creating Java classes at run time.
This artifact is a build of Byte Buddy with a remaining dependency onto ASM.
You should never depend on this module without repackaging Byte Buddy and ASM into your own namespace.
package net.bytebuddy.utility.privilege;
import java.security.PrivilegedAction;
/**
* An action for reading a system property as a privileged action.
*/
public class GetSystemPropertyAction implements PrivilegedAction {
/**
* The property key.
*/
private final String key;
/**
* Creates a new action for reading a system property.
*
* @param key The property key.
*/
public GetSystemPropertyAction(String key) {
this.key = key;
}
@Override
public String run() {
return System.getProperty(key);
}
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
GetSystemPropertyAction that = (GetSystemPropertyAction) object;
return key.equals(that.key);
}
@Override
public int hashCode() {
return key.hashCode();
}
@Override
public String toString() {
return "GetSystemPropertyAction{" +
"key='" + key + '\'' +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy