博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java 根据类名示例化类_Java类类getProtectionDomain()方法及示例
阅读量:2531 次
发布时间:2019-05-11

本文共 2090 字,大约阅读时间需要 6 分钟。

java 根据类名示例化类

类class getProtectionDomain()方法 (Class class getProtectionDomain() method)

  • getProtectionDomain() method is available in java.lang package.

    getProtectionDomain()方法在java.lang包中可用。

  • getProtectionDomain() method is used to return the ProtectionDomain of this class (i.e. ProtectionDomain protects source code by implementing a set of permissions).

    getProtectionDomain()方法用于返回此类的ProtectionDomain(即ProtectionDomain通过实现一组权限来保护源代码)。

  • getProtectionDomain() method is a non-static method, it is accessible with the class objects only and if we try to access the method with the class name then we will get an error.

    getProtectionDomain()方法是一个非静态方法,只能使用类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • getProtectionDomain() method may throw an exception at the time of returning ProtectionDomain of the class.

    返回该类的ProtectionDomain时, getProtectionDomain()方法可能会引发异常。

    SecurityException : In this exception its checkPermission() method restricts ProtectionDomain when security manager exists.

    SecurityException:在此异常中,当安全管理器存在时,其checkPermission()方法将对ProtectionDomain进行限制。

Syntax:

句法:

public ProtectionDomain getProtectionDomain();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of this method is ProtectionDomain, it returns the ProtectionDomain of the class.

该方法的返回类型为ProtectionDomain ,它返回该类的ProtectionDomain。

Example:

例:

// Java program to demonstrate the example // of ProtectionDomain getProtectionDomain() method of Class import java.security.*;public class GetProtectionDomainOfClass {
public static void main(String[] args) throws Exception {
// Get Class object Class cl = Class.forName("java.util.ArrayList"); // It return the ProtectionDomain of the class ArrayList ProtectionDomain pd = cl.getProtectionDomain(); // Display ProtectionDomain of the class System.out.print("ArrayList ProtectionDomain : "); System.out.println(pd); }}

Output

输出量

ArrayList ProtectionDomain : ProtectionDomain  null null 
( ("java.security.AllPermission" "
"))

翻译自:

java 根据类名示例化类

转载地址:http://ufazd.baihongyu.com/

你可能感兴趣的文章
CRC码计算及校验原理的最通俗诠释
查看>>
QTcpSocket的连续发送数据和连续接收数据
查看>>
使用Gitbook来编写你的Api文档
查看>>
jquery扩展 $.fn
查看>>
tomcat 多实例的Sys V风格脚本
查看>>
程序员如何讲清楚技术方案
查看>>
MapReduce-实践1
查看>>
UVa 815 - Flooded!
查看>>
jQuery基础--选择器
查看>>
mybatis使用collection查询集合属性规则
查看>>
Markdown指南
查看>>
influxDB的安装和简单使用
查看>>
JPA框架学习
查看>>
JPA、JTA、XA相关索引
查看>>
机器分配
查看>>
php opcode缓存
查看>>
springcloud之Feign、ribbon设置超时时间和重试机制的总结
查看>>
Go 结构体
查看>>
LINQ巩固
查看>>
观看杨老师(杨旭)Asp.Net Core MVC入门教程记录
查看>>