simpleprincipal.java
来自「这是java2核心技术第七版的源代码」· Java 代码 · 共 33 行
JAVA
33 行
import java.security.*;/** A principal with a named value (such as "role=HR" or "username=harry").*/public class SimplePrincipal implements Principal{ /** Constructs a SimplePrincipal to hold a description and a value. @param roleName the role name */ public SimplePrincipal(String descr, String value) { this.descr = descr; this.value = value; } /** Returns the role name of this principal @return the role name */ public String getName() { return descr + "=" + value; } public boolean equals(Object otherObject) { if (this == otherObject) return true; if (otherObject == null) return false; if (getClass() != otherObject.getClass()) return false; SimplePrincipal other = (SimplePrincipal) otherObject; return getName().equals(other.getName()); } public int hashCode() { return getName().hashCode(); } private String descr; private String value;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?