01: /*
02: * $Id: PropertyConfiguration.java 10256 2008-01-08 15:20:25Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
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: void addReference(String propertyName);
26:
27: void addMapping(String propertyName, Map mappings);
28:
29: void addMapping(String propertyName, String mappings);
30:
31: void addMapping(String propertyName, ValueMap mappings);
32:
33: void addAlias(String alias, String propertyName);
34:
35: /**
36: * This will automatically generate a list and accumulate values.
37: * If the value is a map then instead of generating a list of maps we combine map entries together.
38: */
39: void addCollection(String propertyName);
40:
41: void addIgnored(String propertyName);
42:
43: void removeIgnored(String propertyName);
44:
45: void setIgnoredDefault(boolean ignoreAll);
46:
47: String getAttributeMapping(String alias);
48:
49: boolean isCollection(String propertyName);
50:
51: boolean isIgnored(String propertyName);
52:
53: /**
54: * A property can be explicitly registered as a bean reference via registerBeanReference()
55: * or it can simply use the "-ref" suffix.
56: * @param attributeName true if the name appears to correspond to a reference
57: */
58: boolean isReference(String attributeName);
59:
60: SingleProperty getSingleProperty(String propertyName);
61:
62: /**
63: * Extract a JavaBean property name from the supplied attribute name.
64: * <p>The default implementation uses the {@link org.springframework.core.Conventions#attributeNameToPropertyName(String)}
65: * method to perform the extraction.
66: * <p>The name returned must obey the standard JavaBean property name
67: * conventions. For example for a class with a setter method
68: * '<code>setBingoHallFavourite(String)</code>', the name returned had
69: * better be '<code>bingoHallFavourite</code>' (with that exact casing).
70: *
71: * @param oldName the attribute name taken straight from the XML element being parsed; will never be <code>null</code>
72: * @return the extracted JavaBean property name; must never be <code>null</code>
73: */
74: String translateName(String oldName);
75:
76: Object translateValue(String name, String value);
77:
78: }
|