|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| NameUtil.java | 87,5% | 100% | 80% | 93,5% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml.schema.element; |
|
| 11 |
|
|
| 12 |
import org.jbind.xml.base.INamespaces; |
|
| 13 |
|
|
| 14 |
public class NameUtil {
|
|
| 15 |
|
|
| 16 | 0 |
private NameUtil() {}
|
| 17 |
|
|
| 18 |
|
|
| 19 |
/** |
|
| 20 |
* Gets the element name if the element to be created is in the xml-schema-namespace. |
|
| 21 |
* |
|
| 22 |
* @param aCreationParams <i>(required)</i>. Creation parameters for an element. |
|
| 23 |
* @return <i>(optional)</i>. The local part of the element name is returned iff |
|
| 24 |
* the element is in the xml-schema-namespace. |
|
| 25 |
*/ |
|
| 26 | 5818 |
public static String getSchemaComponentName(CreationParams aCreationParams) {
|
| 27 | 5818 |
String res = null; |
| 28 | 5818 |
String namespaceUri = aCreationParams.myQName.getNamespace(); |
| 29 | 5818 |
if (INamespaces.XML_SCHEMA.equals(namespaceUri)) {
|
| 30 | 5818 |
res = aCreationParams.myQName.getLocalPart(); |
| 31 |
} |
|
| 32 | 5818 |
return res; |
| 33 |
} |
|
| 34 |
|
|
| 35 |
/** |
|
| 36 |
* Gets the element name if the element to be created is in the up-namespace. |
|
| 37 |
* |
|
| 38 |
* @param aCreationParams <i>(required)</i>. Creation parameters for an element. |
|
| 39 |
* @return <i>(optional)</i>. The local part of the element name is returned iff |
|
| 40 |
* the element is in the up-namespace. |
|
| 41 |
*/ |
|
| 42 | 492 |
public static String getExtensionElementName(CreationParams aCreationParams) {
|
| 43 | 492 |
String res = null; |
| 44 | 492 |
String namespaceUri = aCreationParams.myQName.getNamespace(); |
| 45 | 492 |
if (INamespaces.JBIND.equals(namespaceUri)) {
|
| 46 | 30 |
res = aCreationParams.myQName.getLocalPart(); |
| 47 |
} |
|
| 48 | 492 |
return res; |
| 49 |
} |
|
| 50 |
|
|
| 51 | 12454 |
public static String getSchemaAttributeName(ACParams anACParams) {
|
| 52 | 12454 |
String res = null; |
| 53 | 12454 |
if (INamespaces.NO.equals(anACParams.namespace)) {
|
| 54 | 12047 |
res = anACParams.localName; |
| 55 |
} |
|
| 56 | 12454 |
return res; |
| 57 |
} |
|
| 58 |
|
|
| 59 | 8432 |
public static String getBindingAttributeName(ACParams anACParams) {
|
| 60 | 8432 |
String res = null; |
| 61 | 8432 |
if (INamespaces.JBIND.equals(anACParams.namespace)) {
|
| 62 | 472 |
res = anACParams.localName; |
| 63 |
} |
|
| 64 | 8432 |
return res; |
| 65 |
} |
|
| 66 |
|
|
| 67 |
} |
|
| 68 |
|
|
||||||||||