File Source: UserWrapper.java
/*
P/P * Method: org.apache.roller.weblogger.pojos.wrapper.UserWrapper__static_init
*/
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */
18
19 package org.apache.roller.weblogger.pojos.wrapper;
20
21 import java.util.Date;
22 import org.apache.roller.weblogger.pojos.User;
23
24
25 /**
26 * Pojo safety wrapper for User objects.
27 */
28 public class UserWrapper {
29
30 // keep a reference to the wrapped pojo
31 private final User pojo;
32
33 // this is private so that we can force the use of the .wrap(pojo) method
/*
P/P * Method: void org.apache.roller.weblogger.pojos.wrapper.UserWrapper(User)
*
* Postconditions:
* this.pojo == toWrap
* init'ed(this.pojo)
*/
34 private UserWrapper(User toWrap) {
35 this.pojo = toWrap;
36 }
37
38
39 // wrap the given pojo if it is not null
40 public static UserWrapper wrap(User toWrap) {
/*
P/P * Method: UserWrapper wrap(User)
*
* Postconditions:
* return_value == One-of{&new UserWrapper(wrap#1), null}
* return_value in Addr_Set{null,&new UserWrapper(wrap#1)}
* new UserWrapper(wrap#1) num objects <= 1
* new UserWrapper(wrap#1).pojo == toWrap
* new UserWrapper(wrap#1).pojo != null
*
* Test Vectors:
* toWrap: Addr_Set{null}, Inverse{null}
*/
41 if(toWrap != null)
42 return new UserWrapper(toWrap);
43
44 return null;
45 }
46
47
48 /**
49 * This is here for backwards compatability. We no longer allow the
50 * username to be displayed publicly, so screen name is returned instead.
51 */
52 public String getUserName() {
/*
P/P * Method: String getUserName()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.pcStateManager)
* init'ed(this.pojo.screenName)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-11
*
* Postconditions:
* return_value == this.pojo.screenName
* init'ed(return_value)
*/
53 return this.pojo.getScreenName();
54 }
55
56
57 public String getScreenName() {
/*
P/P * Method: String getScreenName()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.pcStateManager)
* init'ed(this.pojo.screenName)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-11
*
* Postconditions:
* return_value == this.pojo.screenName
* init'ed(return_value)
*/
58 return this.pojo.getScreenName();
59 }
60
61
62 public String getFullName() {
/*
P/P * Method: String getFullName()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.fullName)
* init'ed(this.pojo.pcStateManager)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-5
*
* Postconditions:
* return_value == this.pojo.fullName
* init'ed(return_value)
*/
63 return this.pojo.getFullName();
64 }
65
66
67 public String getEmailAddress() {
/*
P/P * Method: String getEmailAddress()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.emailAddress)
* init'ed(this.pojo.pcStateManager)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-3
*
* Postconditions:
* return_value == this.pojo.emailAddress
* init'ed(return_value)
*/
68 return this.pojo.getEmailAddress();
69 }
70
71
72 public Date getDateCreated() {
/*
P/P * Method: Date getDateCreated()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.dateCreated)
* init'ed(this.pojo.pcStateManager)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-2
*
* Postconditions:
* init'ed(return_value)
*/
73 return this.pojo.getDateCreated();
74 }
75
76
77 public String getLocale() {
/*
P/P * Method: String getLocale()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.locale)
* init'ed(this.pojo.pcStateManager)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-7
*
* Postconditions:
* return_value == this.pojo.locale
* init'ed(return_value)
*/
78 return this.pojo.getLocale();
79 }
80
81
82 public String getTimeZone() {
/*
P/P * Method: String getTimeZone()
*
* Preconditions:
* this.pojo != null
* init'ed(this.pojo.pcStateManager)
* init'ed(this.pojo.timeZone)
* (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-12
*
* Postconditions:
* return_value == this.pojo.timeZone
* init'ed(return_value)
*/
83 return this.pojo.getTimeZone();
84 }
85
86 }
SofCheck Inspector Build Version : 2.18479
| UserWrapper.java |
2009-Jan-02 14:25:38 |
| UserWrapper.class |
2009-Sep-04 03:12:32 |