1 /*
2 * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
59 });
60
61
62 /**
63 * @serial
64 */
65 private String name;
66
67 /**
68 * Create a SolarisPrincipal with a Solaris username.
69 *
70 * <p>
71 *
72 * @param name the Unix username for this user.
73 *
74 * @exception NullPointerException if the <code>name</code>
75 * is <code>null</code>.
76 */
77 public SolarisPrincipal(String name) {
78 if (name == null)
79 throw new NullPointerException(rb.getString("provided null name"));
80
81 this.name = name;
82 }
83
84 /**
85 * Return the Unix username for this <code>SolarisPrincipal</code>.
86 *
87 * <p>
88 *
89 * @return the Unix username for this <code>SolarisPrincipal</code>
90 */
91 public String getName() {
92 return name;
93 }
94
95 /**
96 * Return a string representation of this <code>SolarisPrincipal</code>.
97 *
98 * <p>
99 *
100 * @return a string representation of this <code>SolarisPrincipal</code>.
101 */
102 public String toString() {
103 return(rb.getString("SolarisPrincipal: ") + name);
104 }
105
106 /**
107 * Compares the specified Object with this <code>SolarisPrincipal</code>
108 * for equality. Returns true if the given object is also a
109 * <code>SolarisPrincipal</code> and the two SolarisPrincipals
110 * have the same username.
111 *
112 * <p>
113 *
114 * @param o Object to be compared for equality with this
115 * <code>SolarisPrincipal</code>.
116 *
117 * @return true if the specified Object is equal equal to this
118 * <code>SolarisPrincipal</code>.
119 */
120 public boolean equals(Object o) {
121 if (o == null)
122 return false;
123
|
1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
59 });
60
61
62 /**
63 * @serial
64 */
65 private String name;
66
67 /**
68 * Create a SolarisPrincipal with a Solaris username.
69 *
70 * <p>
71 *
72 * @param name the Unix username for this user.
73 *
74 * @exception NullPointerException if the <code>name</code>
75 * is <code>null</code>.
76 */
77 public SolarisPrincipal(String name) {
78 if (name == null)
79 throw new NullPointerException(rb.getString("provided.null.name"));
80
81 this.name = name;
82 }
83
84 /**
85 * Return the Unix username for this <code>SolarisPrincipal</code>.
86 *
87 * <p>
88 *
89 * @return the Unix username for this <code>SolarisPrincipal</code>
90 */
91 public String getName() {
92 return name;
93 }
94
95 /**
96 * Return a string representation of this <code>SolarisPrincipal</code>.
97 *
98 * <p>
99 *
100 * @return a string representation of this <code>SolarisPrincipal</code>.
101 */
102 public String toString() {
103 return(rb.getString("SolarisPrincipal.") + name);
104 }
105
106 /**
107 * Compares the specified Object with this <code>SolarisPrincipal</code>
108 * for equality. Returns true if the given object is also a
109 * <code>SolarisPrincipal</code> and the two SolarisPrincipals
110 * have the same username.
111 *
112 * <p>
113 *
114 * @param o Object to be compared for equality with this
115 * <code>SolarisPrincipal</code>.
116 *
117 * @return true if the specified Object is equal equal to this
118 * <code>SolarisPrincipal</code>.
119 */
120 public boolean equals(Object o) {
121 if (o == null)
122 return false;
123
|