equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
57 * @see #getName() |
57 * @see #getName() |
58 */ |
58 */ |
59 private String name; |
59 private String name; |
60 |
60 |
61 /** |
61 /** |
62 * <p>Creates a JMXPrincipal for a given identity.</p> |
62 * Creates a JMXPrincipal for a given identity. |
63 * |
63 * |
64 * @param name the JMX Remote API name for this identity. |
64 * @param name the JMX Remote API name for this identity. |
65 * |
65 * |
66 * @exception NullPointerException if the <code>name</code> is |
66 * @exception NullPointerException if the <code>name</code> is |
67 * <code>null</code>. |
67 * <code>null</code>. |
72 } |
72 } |
73 |
73 |
74 /** |
74 /** |
75 * Returns the name of this principal. |
75 * Returns the name of this principal. |
76 * |
76 * |
77 * <p> |
|
78 * |
|
79 * @return the name of this <code>JMXPrincipal</code>. |
77 * @return the name of this <code>JMXPrincipal</code>. |
80 */ |
78 */ |
81 public String getName() { |
79 public String getName() { |
82 return name; |
80 return name; |
83 } |
81 } |
84 |
82 |
85 /** |
83 /** |
86 * Returns a string representation of this <code>JMXPrincipal</code>. |
84 * Returns a string representation of this <code>JMXPrincipal</code>. |
87 * |
|
88 * <p> |
|
89 * |
85 * |
90 * @return a string representation of this <code>JMXPrincipal</code>. |
86 * @return a string representation of this <code>JMXPrincipal</code>. |
91 */ |
87 */ |
92 public String toString() { |
88 public String toString() { |
93 return("JMXPrincipal: " + name); |
89 return("JMXPrincipal: " + name); |
96 /** |
92 /** |
97 * Compares the specified Object with this <code>JMXPrincipal</code> |
93 * Compares the specified Object with this <code>JMXPrincipal</code> |
98 * for equality. Returns true if the given object is also a |
94 * for equality. Returns true if the given object is also a |
99 * <code>JMXPrincipal</code> and the two JMXPrincipals |
95 * <code>JMXPrincipal</code> and the two JMXPrincipals |
100 * have the same name. |
96 * have the same name. |
101 * |
|
102 * <p> |
|
103 * |
97 * |
104 * @param o Object to be compared for equality with this |
98 * @param o Object to be compared for equality with this |
105 * <code>JMXPrincipal</code>. |
99 * <code>JMXPrincipal</code>. |
106 * |
100 * |
107 * @return true if the specified Object is equal to this |
101 * @return true if the specified Object is equal to this |
122 } |
116 } |
123 |
117 |
124 /** |
118 /** |
125 * Returns a hash code for this <code>JMXPrincipal</code>. |
119 * Returns a hash code for this <code>JMXPrincipal</code>. |
126 * |
120 * |
127 * <p> |
|
128 * |
|
129 * @return a hash code for this <code>JMXPrincipal</code>. |
121 * @return a hash code for this <code>JMXPrincipal</code>. |
130 */ |
122 */ |
131 public int hashCode() { |
123 public int hashCode() { |
132 return name.hashCode(); |
124 return name.hashCode(); |
133 } |
125 } |