Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Conventions |
|
| 2.0;2 |
1 | /* | |
2 | * $Id: Conventions.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 | package org.mule.config.spring.parsers.assembly.configuration; | |
11 | ||
12 | /** | |
13 | * Overloads the Spring {@link org.springframework.core.Conventions} class, specifically the {@link #attributeNameToPropertyName(String)} | |
14 | * Method to evaluate the first character of the attribute name and ignore if it is upper case since this is not valid Bean notation | |
15 | * and Mule uses upper case to signify a non-bean attribute name. | |
16 | */ | |
17 | public final class Conventions | |
18 | { | |
19 | ||
20 | private Conventions() | |
21 | 0 | { |
22 | // do not instantiate | |
23 | 0 | } |
24 | ||
25 | /** | |
26 | * Overloads the Spring version of this method to tak into account the first character in the attribute name | |
27 | * An upper case char as the first letter of a bean name is not allowed. In Mule this also signifies a non bean property | |
28 | * @param attributeName the attribute name to parse | |
29 | * @return the correctly formatted bean name | |
30 | */ | |
31 | public static String attributeNameToPropertyName(String attributeName) | |
32 | { | |
33 | 0 | char[] chars = attributeName.toCharArray(); |
34 | 0 | if(Character.isUpperCase(chars[0])) |
35 | { | |
36 | 0 | return attributeName; |
37 | } | |
38 | else | |
39 | { | |
40 | 0 | return org.springframework.core.Conventions.attributeNameToPropertyName(attributeName); |
41 | } | |
42 | } | |
43 | } |