Clover icon

sunshower-sdk

  1. Project Clover database Sat May 12 2018 05:15:40 UTC
  2. Package io.sunshower.sdk.core.jaxb

File RenamingStrategy.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
22% of files have more coverage

Code metrics

2
10
4
1
37
25
5
0.5
2.5
4
1.25

Classes

Class Line # Actions
RenamingStrategy 9 10 5
0.7575%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    package io.sunshower.sdk.core.jaxb;
2   
3   
4    import org.eclipse.persistence.oxm.XMLNameTransformer;
5   
6    /**
7    * Created by haswell on 5/4/17.
8    */
 
9    public class RenamingStrategy implements XMLNameTransformer {
10   
11   
 
12  0 toggle public String transformRootElementName(String name) {
13  0 return transformElementName(name.substring(name.lastIndexOf('.') + 1));
14    }
15   
 
16  0 toggle public String transformTypeName(String name) {
17  0 return transformRootElementName(name);
18    }
19   
 
20  2 toggle public String transformElementName(String name) {
21  2 StringBuilder strBldr = new StringBuilder();
22  2 for (char character : name.toCharArray()) {
23  24 if (Character.isUpperCase(character)) {
24  3 strBldr.append('-');
25  3 strBldr.append(Character.toLowerCase(character));
26    } else {
27  21 strBldr.append(character);
28    }
29    }
30  2 return strBldr.toString();
31    }
32   
 
33  1 toggle public String transformAttributeName(String name) {
34  1 return transformElementName(name);
35    }
36   
37    }