View Javadoc

1   /*
2    * $Id: NestedReference.java 471754 2006-11-06 14:55:09Z husted $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts.taglib.nested;
22  
23  import java.io.Serializable;
24  
25  /**
26   * So that a nested hierarchy can penetrate a dynamic JSP include, this class
27   * will hold the details of a bean name and nested property.
28   *
29   * @version $Rev: 471754 $
30   * @since Struts 1.1
31   */
32  public class NestedReference implements Serializable {
33      /* Usual member variables */
34      private String beanName;
35      private String property;
36  
37      /**
38       * Empty constructor.
39       */
40      public NestedReference() {
41      }
42  
43      /**
44       * Constructor takes the all the relevant details to init the object.
45       *
46       * @param name     String name of the bean that the include is to
47       *                 reference
48       * @param property String nested property value that the include will be
49       *                 continuing on with.
50       */
51      public NestedReference(String name, String property) {
52          this.beanName = name;
53          this.property = property;
54      }
55  
56      /**
57       * Getter for the bean name
58       *
59       * @return String value that will be the bean's reference
60       */
61      public String getBeanName() {
62          return beanName;
63      }
64  
65      /**
66       * Setter for the bean name
67       *
68       * @param newName String value to set the bean reference.
69       */
70      public void setBeanName(String newName) {
71          this.beanName = newName;
72      }
73  
74      /**
75       * Getter for the nested property
76       *
77       * @return String value that is the nested property for the current
78       *         nesting
79       */
80      public String getNestedProperty() {
81          return this.property;
82      }
83  
84      /**
85       * Setter for the nested property
86       *
87       * @param newProperty String value of the new current nesting level
88       */
89      public void setNestedProperty(String newProperty) {
90          this.property = newProperty;
91      }
92  }