File Source: WeblogReferrerWrapper.java
/*
P/P * Method: org.apache.roller.weblogger.pojos.wrapper.WeblogReferrerWrapper__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 org.apache.roller.weblogger.business.URLStrategy;
22 import org.apache.roller.weblogger.pojos.WeblogReferrer;
23
24
25 /**
26 * Pojo safety wrapper for WeblogReferrer object.
27 */
28 public class WeblogReferrerWrapper {
29
30 // keep a reference to the wrapped pojo
31 private final WeblogReferrer pojo;
32
33 // url strategy to use for any url building
34 private final URLStrategy urlStrategy;
35
36
37 // 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.WeblogReferrerWrapper(WeblogReferrer, URLStrategy)
*
* Postconditions:
* this.pojo == toWrap
* init'ed(this.pojo)
* this.urlStrategy == strat
* init'ed(this.urlStrategy)
*/
38 private WeblogReferrerWrapper(WeblogReferrer toWrap, URLStrategy strat) {
39 this.pojo = toWrap;
40 this.urlStrategy = strat;
41 }
42
43
44 // wrap the given pojo if it is not null
45 public static WeblogReferrerWrapper wrap(WeblogReferrer toWrap, URLStrategy strat) {
/*
P/P * Method: WeblogReferrerWrapper wrap(WeblogReferrer, URLStrategy)
*
* Postconditions:
* return_value == One-of{&new WeblogReferrerWrapper(wrap#1), null}
* return_value in Addr_Set{null,&new WeblogReferrerWrapper(wrap#1)}
* new WeblogReferrerWrapper(wrap#1) num objects <= 1
* new WeblogReferrerWrapper(wrap#1).pojo == toWrap
* new WeblogReferrerWrapper(wrap#1).pojo != null
* new WeblogReferrerWrapper(wrap#1).urlStrategy == strat
* init'ed(new WeblogReferrerWrapper(wrap#1).urlStrategy)
*
* Test Vectors:
* toWrap: Addr_Set{null}, Inverse{null}
*/
46 if(toWrap != null)
47 return new WeblogReferrerWrapper(toWrap, strat);
48
49 return null;
50 }
51
52
53 public String getId() {
/*
P/P * Method: String getId()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
54 return this.pojo.getId();
55 }
56
57
58 public WeblogWrapper getWebsite() {
/*
P/P * Method: WeblogWrapper getWebsite()
*
* Preconditions:
* this.pojo != null
*
* Presumptions:
* org.apache.roller.weblogger.pojos.WeblogReferrer:getWebsite(...)@59 != null
*
* Postconditions:
* return_value == &new WeblogWrapper(wrap#1)
* new WeblogWrapper(wrap#1) num objects == 1
* new WeblogWrapper(wrap#1).pojo != null
* new WeblogWrapper(wrap#1).urlStrategy == this.urlStrategy
* init'ed(new WeblogWrapper(wrap#1).urlStrategy)
*/
59 return WeblogWrapper.wrap(this.pojo.getWebsite(), urlStrategy);
60 }
61
62
63 public WeblogEntryWrapper getWeblogEntry() {
/*
P/P * Method: WeblogEntryWrapper getWeblogEntry()
*
* Preconditions:
* this.pojo != null
*
* Presumptions:
* org.apache.roller.weblogger.pojos.WeblogReferrer:getWeblogEntry(...)@64 != null
*
* Postconditions:
* return_value == &new WeblogEntryWrapper(wrap#1)
* new WeblogEntryWrapper(wrap#1) num objects == 1
* new WeblogEntryWrapper(wrap#1).pojo != null
* new WeblogEntryWrapper(wrap#1).urlStrategy == this.urlStrategy
* init'ed(new WeblogEntryWrapper(wrap#1).urlStrategy)
*/
64 return WeblogEntryWrapper.wrap(this.pojo.getWeblogEntry(), urlStrategy);
65 }
66
67
68 public String getDateString() {
/*
P/P * Method: String getDateString()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
69 return this.pojo.getDateString();
70 }
71
72
73 public String getRefererUrl() {
/*
P/P * Method: String getRefererUrl()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
74 return this.pojo.getRefererUrl();
75 }
76
77
78 public String getRefererPermalink() {
/*
P/P * Method: String getRefererPermalink()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
79 return this.pojo.getRefererPermalink();
80 }
81
82
83 public String getRequestUrl() {
/*
P/P * Method: String getRequestUrl()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
84 return this.pojo.getRequestUrl();
85 }
86
87
88 public String getTitle() {
/*
P/P * Method: String getTitle()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
89 return this.pojo.getTitle();
90 }
91
92
93 public String getExcerpt() {
/*
P/P * Method: String getExcerpt()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
94 return this.pojo.getExcerpt();
95 }
96
97
98 public Boolean getVisible() {
/*
P/P * Method: Boolean getVisible()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
99 return this.pojo.getVisible();
100 }
101
102
103 public Boolean getDuplicate() {
/*
P/P * Method: Boolean getDuplicate()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
104 return this.pojo.getDuplicate();
105 }
106
107
108 public Integer getDayHits() {
/*
P/P * Method: Integer getDayHits()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
109 return this.pojo.getDayHits();
110 }
111
112
113 public Integer getTotalHits() {
/*
P/P * Method: Integer getTotalHits()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
114 return this.pojo.getTotalHits();
115 }
116
117
118 public String getDisplayUrl(int maxWidth,boolean includeHits) {
/*
P/P * Method: String getDisplayUrl(int, bool)
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
119 return this.pojo.getDisplayUrl(maxWidth,includeHits);
120 }
121
122
123 public String getUrl() {
/*
P/P * Method: String getUrl()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
124 return this.pojo.getUrl();
125 }
126
127
128 public String getDisplayUrl() {
/*
P/P * Method: String getDisplayUrl()
*
* Preconditions:
* this.pojo != null
*
* Postconditions:
* init'ed(return_value)
*/
129 return this.pojo.getDisplayUrl();
130 }
131
132 }
SofCheck Inspector Build Version : 2.18479
| WeblogReferrerWrapper.java |
2009-Jan-02 14:25:02 |
| WeblogReferrerWrapper.class |
2009-Sep-04 03:12:32 |