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