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
63
64 /**
65 * @serial
66 */
67 private String name;
68
69 /**
70 * Create a <code>SolarisNumericUserPrincipal</code> using a
71 * <code>String</code> representation of the
72 * user's identification number (UID).
73 *
74 * <p>
75 *
76 * @param name the user identification number (UID) for this user.
77 *
78 * @exception NullPointerException if the <code>name</code>
79 * is <code>null</code>.
80 */
81 public SolarisNumericUserPrincipal(String name) {
82 if (name == null)
83 throw new NullPointerException(rb.getString("provided null name"));
84
85 this.name = name;
86 }
87
88 /**
89 * Create a <code>SolarisNumericUserPrincipal</code> using a
90 * long representation of the user's identification number (UID).
91 *
92 * <p>
93 *
94 * @param name the user identification number (UID) for this user
95 * represented as a long.
96 */
97 public SolarisNumericUserPrincipal(long name) {
98 this.name = (new Long(name)).toString();
99 }
100
101 /**
102 * Return the user identification number (UID) for this
103 * <code>SolarisNumericUserPrincipal</code>.
117 *
118 * <p>
119 *
120 * @return the user identification number (UID) for this
121 * <code>SolarisNumericUserPrincipal</code> as a long.
122 */
123 public long longValue() {
124 return ((new Long(name)).longValue());
125 }
126
127 /**
128 * Return a string representation of this
129 * <code>SolarisNumericUserPrincipal</code>.
130 *
131 * <p>
132 *
133 * @return a string representation of this
134 * <code>SolarisNumericUserPrincipal</code>.
135 */
136 public String toString() {
137 return(rb.getString("SolarisNumericUserPrincipal: ") + name);
138 }
139
140 /**
141 * Compares the specified Object with this
142 * <code>SolarisNumericUserPrincipal</code>
143 * for equality. Returns true if the given object is also a
144 * <code>SolarisNumericUserPrincipal</code> and the two
145 * SolarisNumericUserPrincipals
146 * have the same user identification number (UID).
147 *
148 * <p>
149 *
150 * @param o Object to be compared for equality with this
151 * <code>SolarisNumericUserPrincipal</code>.
152 *
153 * @return true if the specified Object is equal equal to this
154 * <code>SolarisNumericUserPrincipal</code>.
155 */
156 public boolean equals(Object o) {
157 if (o == null)
|
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
63
64 /**
65 * @serial
66 */
67 private String name;
68
69 /**
70 * Create a <code>SolarisNumericUserPrincipal</code> using a
71 * <code>String</code> representation of the
72 * user's identification number (UID).
73 *
74 * <p>
75 *
76 * @param name the user identification number (UID) for this user.
77 *
78 * @exception NullPointerException if the <code>name</code>
79 * is <code>null</code>.
80 */
81 public SolarisNumericUserPrincipal(String name) {
82 if (name == null)
83 throw new NullPointerException(rb.getString("provided.null.name"));
84
85 this.name = name;
86 }
87
88 /**
89 * Create a <code>SolarisNumericUserPrincipal</code> using a
90 * long representation of the user's identification number (UID).
91 *
92 * <p>
93 *
94 * @param name the user identification number (UID) for this user
95 * represented as a long.
96 */
97 public SolarisNumericUserPrincipal(long name) {
98 this.name = (new Long(name)).toString();
99 }
100
101 /**
102 * Return the user identification number (UID) for this
103 * <code>SolarisNumericUserPrincipal</code>.
117 *
118 * <p>
119 *
120 * @return the user identification number (UID) for this
121 * <code>SolarisNumericUserPrincipal</code> as a long.
122 */
123 public long longValue() {
124 return ((new Long(name)).longValue());
125 }
126
127 /**
128 * Return a string representation of this
129 * <code>SolarisNumericUserPrincipal</code>.
130 *
131 * <p>
132 *
133 * @return a string representation of this
134 * <code>SolarisNumericUserPrincipal</code>.
135 */
136 public String toString() {
137 return(rb.getString("SolarisNumericUserPrincipal.") + name);
138 }
139
140 /**
141 * Compares the specified Object with this
142 * <code>SolarisNumericUserPrincipal</code>
143 * for equality. Returns true if the given object is also a
144 * <code>SolarisNumericUserPrincipal</code> and the two
145 * SolarisNumericUserPrincipals
146 * have the same user identification number (UID).
147 *
148 * <p>
149 *
150 * @param o Object to be compared for equality with this
151 * <code>SolarisNumericUserPrincipal</code>.
152 *
153 * @return true if the specified Object is equal equal to this
154 * <code>SolarisNumericUserPrincipal</code>.
155 */
156 public boolean equals(Object o) {
157 if (o == null)
|