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