subject.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 877 行 · 第 1/3 页

HTML
877
字号
 except that instead of retrieving the current Thread's
 <code>AccessControlContext</code>, it uses the provided
 <code>AccessControlContext</code>.  If the provided
 <code>AccessControlContext</code> is <code>null</code>,
 this method instantiates a new <code>AccessControlContext</code>
 with an empty collection of ProtectionDomains.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>subject</CODE> - the <code>Subject</code> that the specified
			<code>action</code> will run as.  This parameter
			may be <code>null</code>. <p><DD><CODE>action</CODE> - the code to be run as the specified
			<code>Subject</code>. <p><DD><CODE>acc</CODE> - the <code>AccessControlContext</code> to be tied to the
			specified <i>subject</i> and <i>action</i>. <p><DT><B>Returns:</B><DD>the <code>Object</code> returned by the
			PrivilegedExceptionAction's <code>run</code> method.<DT><B>Throws:</B><DD><CODE>java.security.PrivilegedActionException</CODE> - if the
			<code>PrivilegedExceptionAction.run</code>
			method throws a checked exception. <p><DD><CODE>java.lang.NullPointerException</CODE> - if the specified
			<code>PrivilegedExceptionAction</code> is
			<code>null</code>. <p><DD><CODE>java.lang.SecurityException</CODE> - if the caller does not have permission
			to invoke this method.</DL>
</DD>
</DL>
<HR>

<A NAME="getPrincipals()"><!-- --></A><H3>
getPrincipals</H3>
<PRE>
public java.util.Set <B>getPrincipals</B>()</PRE>
<DL>
<DD>Return the <code>Set</code> of Principals associated with this
 <code>Subject</code>.  Each <code>Principal</code> represents
 an identity for this <code>Subject</code>.

 <p> The returned <code>Set</code> is backed by this Subject's
 internal <code>Principal</code> <code>Set</code>.  Any modification
 to the returned <code>Set</code> affects the internal
 <code>Principal</code> <code>Set</code> as well.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>The <code>Set</code> of Principals associated with this
		<code>Subject</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="getPrincipals(java.lang.Class)"><!-- --></A><H3>
getPrincipals</H3>
<PRE>
public java.util.Set <B>getPrincipals</B>(java.lang.Class&nbsp;c)</PRE>
<DL>
<DD>Return a <code>Set</code> of Principals associated with this
 <code>Subject</code> that are instances or subclasses of the specified
 <code>Class</code>.

 <p> The returned <code>Set</code> is not backed by this Subject's
 internal <code>Principal</code> <code>Set</code>.  A new
 <code>Set</code> is created and returned for each method invocation.
 Modifications to the returned <code>Set</code>
 will not affect the internal <code>Principal</code> <code>Set</code>.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - the returned <code>Set</code> of Principals will all be
		instances of this class.<DT><B>Returns:</B><DD>a <code>Set</code> of Principals that are instances of the
		specified <code>Class</code>.<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if the specified <code>Class</code>
			is <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="getPublicCredentials()"><!-- --></A><H3>
getPublicCredentials</H3>
<PRE>
public java.util.Set <B>getPublicCredentials</B>()</PRE>
<DL>
<DD>Return the <code>Set</code> of public credentials held by this
 <code>Subject</code>.

 <p> The returned <code>Set</code> is backed by this Subject's
 internal public Credential <code>Set</code>.  Any modification
 to the returned <code>Set</code> affects the internal public
 Credential <code>Set</code> as well.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>A <code>Set</code> of public credentials held by this
		<code>Subject</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="getPrivateCredentials()"><!-- --></A><H3>
getPrivateCredentials</H3>
<PRE>
public java.util.Set <B>getPrivateCredentials</B>()</PRE>
<DL>
<DD>Return the <code>Set</code> of private credentials held by this
 <code>Subject</code>.

 <p> The returned <code>Set</code> is backed by this Subject's
 internal private Credential <code>Set</code>.  Any modification
 to the returned <code>Set</code> affects the internal private
 Credential <code>Set</code> as well.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>A <code>Set</code> of private credentials held by this
		<code>Subject</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="getPublicCredentials(java.lang.Class)"><!-- --></A><H3>
getPublicCredentials</H3>
<PRE>
public java.util.Set <B>getPublicCredentials</B>(java.lang.Class&nbsp;c)</PRE>
<DL>
<DD>Return a <code>Set</code> of public credentials associated with this
 <code>Subject</code> that are instances or subclasses of the specified
 <code>Class</code>.

 <p> The returned <code>Set</code> is not backed by this Subject's
 internal public Credential <code>Set</code>.  A new
 <code>Set</code> is created and returned for each method invocation.
 Modifications to the returned <code>Set</code>
 will not affect the internal public Credential <code>Set</code>.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - the returned <code>Set</code> of public credentials will all be
		instances of this class.<DT><B>Returns:</B><DD>a <code>Set</code> of public credentials that are instances
		of the	specified <code>Class</code>.<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if the specified <code>Class</code>
		is <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="getPrivateCredentials(java.lang.Class)"><!-- --></A><H3>
getPrivateCredentials</H3>
<PRE>
public java.util.Set <B>getPrivateCredentials</B>(java.lang.Class&nbsp;c)</PRE>
<DL>
<DD>Return a <code>Set</code> of private credentials associated with this
 <code>Subject</code> that are instances or subclasses of the specified
 <code>Class</code>.

 <p> The returned <code>Set</code> is not backed by this Subject's
 internal private Credential <code>Set</code>.  A new
 <code>Set</code> is created and returned for each method invocation.
 Modifications to the returned <code>Set</code>
 will not affect the internal private Credential <code>Set</code>.

 <p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>c</CODE> - the returned <code>Set</code> of private credentials will all be
		instances of this class.<DT><B>Returns:</B><DD>a <code>Set</code> of private credentials that are instances
		of the	specified <code>Class</code>.<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if the specified <code>Class</code>
		is <code>null</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
equals</H3>
<PRE>
public boolean <B>equals</B>(java.lang.Object&nbsp;o)</PRE>
<DL>
<DD>Compares the specified Object with this <code>Subject</code>
 for equality.  Returns true if the given object is also a Subject
 and the two <code>Subject</code> instances are equivalent.
 More formally, two <code>Subject</code> instances are
 equal if their <code>Principal</code> and <code>Credential</code>
 Sets are equal.

 <p><DD><DL>
<DT><B>Overrides:</B><DD><CODE>equals</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - Object to be compared for equality with this
		<code>Subject</code>.<DT><B>Returns:</B><DD>true if the specified Object is equal to this
		<code>Subject</code>.<DT><B>Throws:</B><DD><CODE>java.lang.SecurityException</CODE> - if the caller does not have permission
		to access the private credentials for this <code>Subject</code>,
		or if the caller does not have permission to access the
		private credentials for the provided <code>Subject</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <B>toString</B>()</PRE>
<DL>
<DD>Return the String representation of this <code>Subject</code>.

 <p><DD><DL>
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the String representation of this <code>Subject</code>.</DL>
</DD>
</DL>
<HR>

<A NAME="hashCode()"><!-- --></A><H3>
hashCode</H3>
<PRE>
public int <B>hashCode</B>()</PRE>
<DL>
<DD>Returns a hashcode for this <code>Subject</code>.

 <p> The hashcode is derived exclusive or-ing the
 hashcodes of this Subject's Principals and credentials.

 <p> If a particular credential was destroyed
 (<code>credential.hashCode()</code> throws an
 <code>IllegalStateException</code>),
 the hashcode for that credential is derived via:
 <code>credential.getClass().toString().hashCode()</code>.

 <p><DD><DL>
<DT><B>Overrides:</B><DD><CODE>hashCode</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a hashcode for this <code>Subject</code>.<DT><B>Throws:</B><DD><CODE>java.lang.SecurityException</CODE> - if the caller does not have permission
		to access this Subject's private credentials.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/security/auth/PrivateCredentialPermission.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/security/auth/SubjectDomainCombiner.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="Subject.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?