本文整理汇总了Java中java.security.Provider.Service.getClassName方法的典型用法代码示例。如果您正苦于以下问题:Java Service.getClassName方法的具体用法?Java Service.getClassName怎么用?Java Service.getClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.Provider.Service
的用法示例。
在下文中一共展示了Service.getClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSpi
import java.security.Provider.Service; //导入方法依赖的package包/类
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
示例2: checkSuperClass
import java.security.Provider.Service; //导入方法依赖的package包/类
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}