io.spiffe.workloadapi.AddressScheme Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-spiffe-core Show documentation
Show all versions of java-spiffe-core Show documentation
Core functionality to fetch, process and validate X.509 and JWT SVIDs and Bundles from the Workload API.
package io.spiffe.workloadapi;
/**
* Address Scheme names enum.
*/
public enum AddressScheme {
UNIX_SCHEME("unix"),
TCP_SCHEME("tcp");
private final String name;
AddressScheme(final String scheme) {
this.name = scheme;
}
/**
* Parses and returns an AddressScheme instance.
*
* @param scheme a string representing an Address Scheme ('unix' or 'tcp')
* @return the enum instance representing the scheme
* @throws IllegalArgumentException if the scheme is not 'unix' or 'tcp'
*/
public static AddressScheme parseScheme(String scheme) {
if ("unix".equals(scheme)) {
return UNIX_SCHEME;
} else if ("tcp".equals(scheme)) {
return TCP_SCHEME;
} else {
throw new IllegalArgumentException("Address Scheme not supported: ");
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy