Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
BeanLifecycle |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | ||
15 | package org.apache.tapestry.spec; |
|
16 | ||
17 | /** |
|
18 | * An enumeration of the different possible lifecycles for a JavaBean. |
|
19 | * |
|
20 | * @author Howard Lewis Ship |
|
21 | * @since 1.0.4 |
|
22 | */ |
|
23 | ||
24 | public final class BeanLifecycle |
|
25 | { |
|
26 | /** |
|
27 | * No lifecycle; the bean is created fresh on each reference and not retained. |
|
28 | */ |
|
29 | ||
30 | 1 | public static final BeanLifecycle NONE = new BeanLifecycle("NONE"); |
31 | ||
32 | /** |
|
33 | * The standard lifecycle; the bean is retained for the duration of the request cycle and is |
|
34 | * discarded at the end of the request cycle. |
|
35 | */ |
|
36 | ||
37 | 1 | public static final BeanLifecycle REQUEST = new BeanLifecycle("REQUEST"); |
38 | ||
39 | /** |
|
40 | * The bean is created once and reused for the lifespan of the page containing the component. |
|
41 | */ |
|
42 | ||
43 | 1 | public static final BeanLifecycle PAGE = new BeanLifecycle("PAGE"); |
44 | ||
45 | /** |
|
46 | * The bean is create and reused until the end of the current render, at which point it is |
|
47 | * discarded. |
|
48 | * |
|
49 | * @since 2.2 |
|
50 | */ |
|
51 | ||
52 | 1 | public static final BeanLifecycle RENDER = new BeanLifecycle("RENDER"); |
53 | ||
54 | private final String _name; |
|
55 | ||
56 | private BeanLifecycle(String name) |
|
57 | 4 | { |
58 | 4 | _name = name; |
59 | 4 | } |
60 | ||
61 | public String toString() |
|
62 | { |
|
63 | 0 | return "BeanLifecycle[" + _name + "]"; |
64 | } |
|
65 | ||
66 | public String getName() |
|
67 | { |
|
68 | 0 | return _name; |
69 | } |
|
70 | ||
71 | } |