View Javadoc
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  package org.apache.commons.configuration2.beanutils;
18  
19  import java.util.Collection;
20  import java.util.Map;
21  
22  /**
23   * A test implementation of the BeanDeclaration interface. This implementation allows setting the values directly, which
24   * should be returned by the methods required by the BeanDeclaration interface. It is used by multiple test classes.
25   */
26  final class BeanDeclarationTestImpl implements BeanDeclaration {
27      private String beanClassName;
28  
29      private String beanFactoryName;
30  
31      private Object beanFactoryParameter;
32  
33      private Map<String, Object> beanProperties;
34  
35      private Map<String, Object> nestedBeanDeclarations;
36  
37      private Collection<ConstructorArg> constructorArgs;
38  
39      @Override
40      public String getBeanClassName() {
41          return beanClassName;
42      }
43  
44      @Override
45      public String getBeanFactoryName() {
46          return beanFactoryName;
47      }
48  
49      @Override
50      public Object getBeanFactoryParameter() {
51          return beanFactoryParameter;
52      }
53  
54      @Override
55      public Map<String, Object> getBeanProperties() {
56          return beanProperties;
57      }
58  
59      @Override
60      public Collection<ConstructorArg> getConstructorArgs() {
61          return constructorArgs;
62      }
63  
64      @Override
65      public Map<String, Object> getNestedBeanDeclarations() {
66          return nestedBeanDeclarations;
67      }
68  
69      public void setBeanClassName(final String beanClassName) {
70          this.beanClassName = beanClassName;
71      }
72  
73      public void setBeanFactoryName(final String beanFactoryName) {
74          this.beanFactoryName = beanFactoryName;
75      }
76  
77      public void setBeanFactoryParameter(final Object beanFactoryParameter) {
78          this.beanFactoryParameter = beanFactoryParameter;
79      }
80  
81      public void setBeanProperties(final Map<String, Object> beanProperties) {
82          this.beanProperties = beanProperties;
83      }
84  
85      public void setConstructorArgs(final Collection<ConstructorArg> args) {
86          constructorArgs = args;
87      }
88  
89      public void setNestedBeanDeclarations(final Map<String, Object> nestedBeanDeclarations) {
90          this.nestedBeanDeclarations = nestedBeanDeclarations;
91      }
92  }