    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17
    18
    19  package org.apache.commons.beanutils.priv;
    20
    21
    22  /***
    23   * Bean that has a private constructor that exposes properties via
    24   * various mechanisms (based on property name):
    25   * <ul>
    26   * <li><strong>foo</strong> - Via direct public method
    27   * <li><strong>bar</strong> - Via directly implemented interface
    28   * <li><strong>baz</strong> - Via indirectly implemented interface
    29   * </ul>
    30   *
    31   * @author Craig R. McClanahan
    32   * @version $Revision: 438363 $ $Date: 2006-08-30 05:48:00 +0100 (Wed, 30 Aug 2006) $
    33   */
    34
    35  class PrivateBean implements PrivateDirect {
    36
    37
    38      // ----------------------------------------------------------- Constructors
    39
    40
    41      /***
    42       * Package private constructor - can only use factory method to create
    43       * beans.
    44       */
    45      PrivateBean() {
    46
    47          super();
    48
    49      }
    50
    51
    52      // ------------------------------------------------------------- Properties
    53
    54
    55      /***
    56       * A directly implemented property.
    57       */
    58      private String foo = "This is foo";
    59
    60      public String getFoo() {
    61
    62          return (this.foo);
    63
    64      }
    65
    66
    67      /***
    68       * A property accessible via a directly implemented interface.
    69       */
    70      private String bar = "This is bar";
    71
    72      public String getBar() {
    73
    74          return (this.bar);
    75
    76      }
    77
    78
    79      /***
    80       * A method accessible via a directly implemented interface.
    81       */
    82      public String methodBar(String in) {
    83
    84          return (in);
    85
    86      }
    87
    88
    89      /***
    90       * A property accessible via an indirectly implemented interface.
    91       */
    92      private String baz = "This is baz";
    93
    94      public String getBaz() {
    95
    96          return (this.baz);
    97
    98      }
    99
    100
    101     /***
    102      * A method accessible via an indirectly implemented interface.
    103      */
    104     public String methodBaz(String in) {
    105
    106         return (in);
    107
    108     }
    109
    110
    111 }