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 * @version $Id$ 32 */ 33 34 class PrivateBean implements PrivateDirect { 35 36 37 // ----------------------------------------------------------- Constructors 38 39 40 /** 41 * Package private constructor - can only use factory method to create 42 * beans. 43 */ 44 PrivateBean() { 45 46 super(); 47 48 } 49 50 51 // ------------------------------------------------------------- Properties 52 53 54 /** 55 * A directly implemented property. 56 */ 57 private final String foo = "This is foo"; 58 59 public String getFoo() { 60 61 return (this.foo); 62 63 } 64 65 66 /** 67 * A property accessible via a directly implemented interface. 68 */ 69 private final String bar = "This is bar"; 70 71 public String getBar() { 72 73 return (this.bar); 74 75 } 76 77 78 /** 79 * A method accessible via a directly implemented interface. 80 */ 81 public String methodBar(final String in) { 82 83 return (in); 84 85 } 86 87 88 /** 89 * A property accessible via an indirectly implemented interface. 90 */ 91 private final String baz = "This is baz"; 92 93 public String getBaz() { 94 95 return (this.baz); 96 97 } 98 99 100 /** 101 * A method accessible via an indirectly implemented interface. 102 */ 103 public String methodBaz(final String in) { 104 105 return (in); 106 107 } 108 109 110 }