📄 simpleprincipal.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -