java.lang.Class.getSigners()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中java.lang.Class.getSigners()方法的一些代码示例,展示了Class.getSigners()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Class.getSigners()方法的具体详情如下:
包路径:java.lang.Class
类名称:Class
方法名:getSigners

Class.getSigners介绍

[英]Returns null. (On Android, a ClassLoader can load classes from multiple dex files. All classes from any given dex file will have the same signers, but different dex files may have different signers. This does not fit well with the original ClassLoader-based model of getSigners.)
[中]返回null。(在Android上,类加载器可以从多个dex文件加载类。任何给定dex文件中的所有类都将具有相同的签名者,但不同的dex文件可能具有不同的签名者。这与原始基于类加载器的getSigners模型不符。)

代码示例

代码示例来源:origin: spring-projects/spring-loaded

public static Object[] callGetSigners(Class thiz)
{
  return thiz.getSigners();
}

代码示例来源:origin: spockframework/spock

private static boolean isComingFromSignedJar(Class<?> type) {
 return type.getSigners() != null;
}

代码示例来源:origin: org.easymock/easymock

private Enhancer createEnhancer(Class<?> toMock) {
  // Create the mock
  Enhancer enhancer = new Enhancer() {
    /**
     * Filter all private constructors but do not check that there are
     * some left
     */
    @SuppressWarnings("rawtypes")
    @Override
    protected void filterConstructors(Class sc, List constructors) {
      CollectionUtils.filter(constructors, new VisibilityPredicate(sc, true));
    }
  };
  enhancer.setSuperclass(toMock);
  // ///CLOVER:OFF (I don't know how to test it automatically yet)
  // See issue ID: 2994002
  if (toMock.getSigners() != null) {
    enhancer.setNamingPolicy(ALLOWS_MOCKING_CLASSES_IN_SIGNED_PACKAGES);
  }
  // ///CLOVER:ON
  return enhancer;
}

代码示例来源:origin: btraceio/btrace

write("protectionDomain", protDomain);
Object[] signers = clazz.getSigners();
if (signers != null && signers.length > 0) {
  write("signers", signers);

代码示例来源:origin: google/j2objc

if (mockedType.getSigners() != null) {
  enhancer.setNamingPolicy(NAMING_POLICY_THAT_ALLOWS_IMPOSTERISATION_OF_CLASSES_IN_SIGNED_PACKAGES);
} else {

代码示例来源:origin: org.powermock/powermock-api-mockito

if (mockedType.getSigners() != null) {
  enhancer.setNamingPolicy(NAMING_POLICY_THAT_ALLOWS_IMPOSTERISATION_OF_CLASSES_IN_SIGNED_PACKAGES);
} else {

代码示例来源:origin: weld/core

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: weld/core

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: weld/core

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: org.jboss.weld.se/weld-se-shaded

private static String getDefaultPackageReason(Class<?> clazz) {
    if (clazz.getPackage() == null) {
      return NULL;
    }
    if (clazz.getSigners() != null) {
      return SIGNED;
    }
    return null;
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

private <T> String getSubClassName(Class<T> classToProxy)
{
  if (classToProxy.getSigners() != null)
  {
    return getSignedClassProxyName(classToProxy) + SUB_CLASS_NAME_SUFFIX;
  }
  return fixPreservedPackages(classToProxy.getName() + SUB_CLASS_NAME_SUFFIX);
}

代码示例来源:origin: au.net.zeus.jgdms/jgdms-platform

Permission resolve(Class targetType) {
  // check signers at first
  if (PolicyUtils.matchSubset( targetCerts, targetType.getSigners())) {
    try {
       return PolicyUtils.instantiatePermission(targetType, name, actions);
    } catch (Exception ignore) {
      //TODO log warning?
    }
  }
  return null;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod
public IRubyObject signers() {
  return Java.getInstance(getRuntime(), javaClass().getSigners());
}

代码示例来源:origin: org.netbeans.api/org-jruby

@JRubyMethod
public IRubyObject signers() {
  return Java.getInstance(getRuntime(), javaClass().getSigners());
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod
public IRubyObject signers() {
  return Java.getInstance(getRuntime(), javaClass().getSigners());
}

代码示例来源:origin: mariofusco/lambdaj

private Class<?> createProxyClass(Class<?> mockedType, Class<?>...interfaces) {
  if (mockedType == Object.class) mockedType = ClassWithSuperclassToWorkAroundCglibBug.class;
  
  Enhancer enhancer = new ClassEnhancer();
  enhancer.setUseFactory(true);
  enhancer.setSuperclass(mockedType);
  enhancer.setInterfaces(interfaces);
  enhancer.setCallbackTypes(new Class[]{MethodInterceptor.class, NoOp.class});
  enhancer.setCallbackFilter(IGNORE_BRIDGE_METHODS);
  enhancer.setNamingPolicy(mockedType.getSigners() != null ? SIGNED_CLASSES_POLICY : DEFAULT_POLICY);
  
  return enhancer.createClass();
}

代码示例来源:origin: arquillian/arquillian-graphene

private Class<?> createProxyClass(Class<?> mockedType, Class<?>...interfaces) {
  if (mockedType == Object.class) mockedType = ClassWithSuperclassToWorkAroundCglibBug.class;
  Enhancer enhancer = new ClassEnhancer();
  enhancer.setUseFactory(true);
  enhancer.setSuperclass(mockedType);
  enhancer.setInterfaces(interfaces);
  enhancer.setCallbackTypes(new Class[]{MethodInterceptor.class, NoOp.class});
  enhancer.setCallbackFilter(IGNORED_METHODS);
  enhancer.setNamingPolicy(mockedType.getSigners() != null ? SIGNED_CLASSES_POLICY : DEFAULT_POLICY);
  return enhancer.createClass();
}

代码示例来源:origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

private Class<?> createProxyClass(Class<?> mockedType, Class<?>...interfaces) {
  if (mockedType == Object.class) mockedType = ClassWithSuperclassToWorkAroundCglibBug.class;
  Enhancer enhancer = new ClassEnhancer();
  enhancer.setUseFactory(true);
  enhancer.setSuperclass(mockedType);
  enhancer.setInterfaces(interfaces);
  enhancer.setCallbackTypes(new Class[]{MethodInterceptor.class, NoOp.class});
  enhancer.setCallbackFilter(IGNORED_METHODS);
  enhancer.setNamingPolicy(mockedType.getSigners() != null ? SIGNED_CLASSES_POLICY : DEFAULT_POLICY);
  return enhancer.createClass();
}

相关文章

Class类方法