KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > scrape > ScrapeData


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  */

16
17 package org.apache.taglibs.scrape;
18
19 import java.util.*;
20
21 /**
22  * ScrapeData - An object used to store data for a scrape, data stored is a
23  * scrapeid, begin and end markers, flags, and the results of
24  * the scrape
25  *
26  * @author Rich Catlett
27  *
28  * @version 1.0
29  *
30  */

31 public class ScrapeData {
32
33     /**
34      * flag determines if tags (anything enclosed by < >) are kept in the result
35      */

36     private boolean stripflag = false;
37     /**
38      * flag determines if begin and end markers are kept in the result default
39      * value of false says they are not kept
40      */

41     private boolean anchorsflag = false;
42     /**
43      * beginning marker of this request
44      */

45     private String JavaDoc begin = new String JavaDoc();
46     /**
47      * end marker of this request
48      */

49     private String JavaDoc end = new String JavaDoc();
50     /**
51      * the result of this particular scrape
52      */

53     private StringBuffer JavaDoc result = new StringBuffer JavaDoc("");
54
55     /**
56      * constructor simply creates an instance of ScrapeData
57      *
58      */

59     public ScrapeData() {}
60
61     /**
62      * getter method for stripflag
63      *
64      * @return boolean value of the Boolean object stripflag
65      *
66      */

67     public final boolean getstripFlag() {
68     return stripflag;
69     }
70
71     /**
72      * setter method for stripflag
73      *
74      * @param notags a boolean value that determines if tags are kept in the
75      * result
76      */

77     public final void setstripFlag(String JavaDoc notags) {
78     if (notags.equalsIgnoreCase("true"))
79         stripflag = true;
80     else
81         stripflag = false;
82     }
83
84     /**
85      * getter method for anchorsflag
86      *
87      * @return boolean value of anchorsflag
88      *
89      */

90     public final boolean getanchorsFlag() {
91     return anchorsflag;
92     }
93
94     /**
95      * setter method for anchorsflag
96      *
97      * @param markers a boolean value that determines if begin and end tags
98      * are kept in the result
99      */

100     public final void setanchorsFlag(String JavaDoc markers) {
101     if (markers.equalsIgnoreCase("true"))
102         anchorsflag = true;
103     else
104         anchorsflag = false;
105     }
106
107     /**
108      * setter method for the beginning anchor for this scrape
109      *
110      * @param begin anchor for the beginning of this scrape
111      *
112      */

113     public final void setBegin(String JavaDoc begin) {
114       this.begin = begin;
115     }
116
117     /**
118      * getter method for the beginning anchor for this scrape
119      *
120      * @return the begin anchor for this scrape
121      *
122      */

123     public final String JavaDoc getBegin() {
124     return begin;
125     }
126
127     /**
128      * setter method for the ending anchor for this scrape
129      *
130      * @param end anchor for the end of this scrape
131      */

132     public final void setEnd(String JavaDoc end) {
133       this.end = end;
134     }
135
136     /**
137      * getter method for the ending anchor for this scrape
138      *
139      * @return the end anchor for this scrpae
140      *
141      */

142     public final String JavaDoc getEnd() {
143     return end;
144     }
145
146     /**
147      * setter method for result
148      *
149      * @param result the result of the scrape with this begin and end
150      *
151      */

152     public final void setResult(String JavaDoc result) {
153     this.result.setLength(0); // make sure that result is empty
154
this.result.append(result);
155     }
156
157     /**
158      * getter method for result
159      *
160      * @return the result of the scrape with this begin and end
161      *
162      */

163     public final String JavaDoc getResult() {
164     return result.toString();
165     }
166 }
167
Popular Tags