View Javadoc

1   /*
2    * $Id: PropertyConfiguration.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.config.spring.parsers.assembly.configuration;
12  
13  import java.util.Map;
14  
15  /**
16   * This collects together various constraints/rewrites that can be applied to attributes.  It
17   * was extracted from AbstractMuleBeanDefinitionParser and should be used as a delegate
18   * (see that class for an example).
19   *
20   * <p>Ignored, reference and collection flags are all keyed off the "old" name (before any alias
21   * or mapping), with any "-ref" dropped.  No normalisation of mapping or aliases is attempted.</p>
22   */
23  public interface PropertyConfiguration
24  {
25  
26      void addReference(String propertyName);
27  
28      void addMapping(String propertyName, Map mappings);
29  
30      void addMapping(String propertyName, String mappings);
31  
32      void addMapping(String propertyName, ValueMap mappings);
33  
34      void addAlias(String alias, String propertyName);
35  
36      /**
37       * This will automatically generate a list and accumulate values.
38       * If the value is a map then instead of generating a list of maps we combine map entries together.
39       */
40      void addCollection(String propertyName);
41  
42      void addIgnored(String propertyName);
43  
44      void removeIgnored(String propertyName);
45  
46      void setIgnoredDefault(boolean ignoreAll);
47  
48      String getAttributeMapping(String alias);
49  
50      String getAttributeAlias(String name);
51  
52      boolean isCollection(String propertyName);
53  
54      boolean isIgnored(String propertyName);
55  
56      /**
57       * A property can be explicitly registered as a bean reference via registerBeanReference()
58       * or it can simply use the "-ref" suffix.
59       * @param attributeName true if the name appears to correspond to a reference
60       */
61      boolean isReference(String attributeName);
62  
63      SingleProperty getSingleProperty(String propertyName);
64  
65       /**
66       * Extract a JavaBean property name from the supplied attribute name.
67       * <p>The default implementation uses the {@link org.springframework.core.Conventions#attributeNameToPropertyName(String)}
68       * method to perform the extraction.
69       * <p>The name returned must obey the standard JavaBean property name
70       * conventions. For example for a class with a setter method
71       * '<code>setBingoHallFavourite(String)</code>', the name returned had
72       * better be '<code>bingoHallFavourite</code>' (with that exact casing).
73       *
74       * @param oldName the attribute name taken straight from the XML element being parsed; will never be <code>null</code>
75       * @return the extracted JavaBean property name; must never be <code>null</code>
76       */
77      String translateName(String oldName);
78  
79      Object translateValue(String name, String value);
80  
81  }