001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.commons.beanutils.priv;
019:
020: /**
021: * Bean that has a private constructor that exposes properties via
022: * various mechanisms (based on property name):
023: * <ul>
024: * <li><strong>foo</strong> - Via direct public method
025: * <li><strong>bar</strong> - Via directly implemented interface
026: * <li><strong>baz</strong> - Via indirectly implemented interface
027: * </ul>
028: *
029: * @author Craig R. McClanahan
030: * @version $Revision: 438363 $ $Date: 2006-08-30 05:48:00 +0100 (Wed, 30 Aug 2006) $
031: */
032:
033: class PrivateBean implements PrivateDirect {
034:
035: // ----------------------------------------------------------- Constructors
036:
037: /**
038: * Package private constructor - can only use factory method to create
039: * beans.
040: */
041: PrivateBean() {
042:
043: super ();
044:
045: }
046:
047: // ------------------------------------------------------------- Properties
048:
049: /**
050: * A directly implemented property.
051: */
052: private String foo = "This is foo";
053:
054: public String getFoo() {
055:
056: return (this .foo);
057:
058: }
059:
060: /**
061: * A property accessible via a directly implemented interface.
062: */
063: private String bar = "This is bar";
064:
065: public String getBar() {
066:
067: return (this .bar);
068:
069: }
070:
071: /**
072: * A method accessible via a directly implemented interface.
073: */
074: public String methodBar(String in) {
075:
076: return (in);
077:
078: }
079:
080: /**
081: * A property accessible via an indirectly implemented interface.
082: */
083: private String baz = "This is baz";
084:
085: public String getBaz() {
086:
087: return (this .baz);
088:
089: }
090:
091: /**
092: * A method accessible via an indirectly implemented interface.
093: */
094: public String methodBaz(String in) {
095:
096: return (in);
097:
098: }
099:
100: }
|