Coverage Report - org.kuali.rice.ksb.api.bus.support.JavaServiceConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
JavaServiceConfiguration
72%
8/11
25%
1/4
1.4
JavaServiceConfiguration$1
N/A
N/A
1.4
JavaServiceConfiguration$Builder
92%
12/13
50%
1/2
1.4
JavaServiceConfiguration$Constants
0%
0/1
N/A
1.4
JavaServiceConfiguration$Elements
0%
0/1
N/A
1.4
 
 1  
 package org.kuali.rice.ksb.api.bus.support;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Collections;
 5  
 import java.util.List;
 6  
 
 7  
 import javax.xml.bind.annotation.XmlAccessType;
 8  
 import javax.xml.bind.annotation.XmlAccessorType;
 9  
 import javax.xml.bind.annotation.XmlElement;
 10  
 import javax.xml.bind.annotation.XmlElementWrapper;
 11  
 import javax.xml.bind.annotation.XmlRootElement;
 12  
 import javax.xml.bind.annotation.XmlType;
 13  
 
 14  
 @XmlRootElement(name = JavaServiceConfiguration.Constants.ROOT_ELEMENT_NAME)
 15  
 @XmlAccessorType(XmlAccessType.NONE)
 16  
 @XmlType(name = JavaServiceConfiguration.Constants.TYPE_NAME, propOrder = {
 17  
                 JavaServiceConfiguration.Elements.SERVICE_INTERFACES
 18  
 })
 19  2
 public final class JavaServiceConfiguration extends AbstractServiceConfiguration {
 20  
 
 21  
         private static final long serialVersionUID = -4226512121638441108L;
 22  
 
 23  
         @XmlElementWrapper(name = Elements.SERVICE_INTERFACES, required = false)
 24  
         @XmlElement(name = Elements.SERVICE_INTERFACE, required = false)
 25  
         private final List<String> serviceInterfaces;
 26  
         
 27  
         /**
 28  
      * Private constructor used only by JAXB.
 29  
      */
 30  
         private JavaServiceConfiguration() {
 31  5
                 super();
 32  5
                 this.serviceInterfaces = null;
 33  5
         }
 34  
 
 35  
         
 36  
         private JavaServiceConfiguration(Builder builder) {
 37  2
                 super(builder);
 38  2
                 this.serviceInterfaces = builder.getServiceInterfaces() == null ? null : new ArrayList<String>(builder.getServiceInterfaces());
 39  2
         }
 40  
         
 41  
         public static JavaServiceConfiguration fromServiceDefinition(JavaServiceDefinition javaServiceDefinition) {
 42  2
                 return Builder.create(javaServiceDefinition).build();
 43  
         }
 44  
                 
 45  
         public List<String> getServiceInterfaces() {
 46  0
                 if (this.serviceInterfaces == null) {
 47  0
                         return Collections.emptyList();
 48  
                 }
 49  0
                 return Collections.unmodifiableList(this.serviceInterfaces);
 50  
         }
 51  
                 
 52  48
         public static final class Builder extends AbstractServiceConfiguration.Builder<JavaServiceConfiguration> {
 53  
 
 54  
                 private static final long serialVersionUID = 4300659121377259098L;
 55  
 
 56  
                 private List<String> serviceInterfaces;
 57  
                                 
 58  
                 public List<String> getServiceInterfaces() {
 59  4
                         return serviceInterfaces;
 60  
                 }
 61  
                 
 62  
                 public void setServiceInterfaces(List<String> serviceInterfaces) {
 63  2
                         if (serviceInterfaces == null) {
 64  0
                                 this.serviceInterfaces = null;
 65  
                         } else {
 66  2
                                 this.serviceInterfaces = new ArrayList<String>(serviceInterfaces);
 67  
                         }
 68  2
                 }
 69  
                 
 70  2
                 private Builder() {}
 71  
                 
 72  
                 public static Builder create() {
 73  2
                         return new Builder();
 74  
                 }
 75  
                 
 76  
                 public static Builder create(JavaServiceDefinition javaServiceDefinition) {
 77  2
                         Builder builder = create();
 78  2
                         builder.copyServiceDefinitionProperties(javaServiceDefinition);
 79  2
                         builder.setServiceInterfaces(javaServiceDefinition.getServiceInterfaces());
 80  2
                         return builder;
 81  
                 }
 82  
 
 83  
                 @Override
 84  
                 public JavaServiceConfiguration build() {
 85  2
                         return new JavaServiceConfiguration(this);
 86  
                 }
 87  
                 
 88  
         }
 89  
         
 90  
         /**
 91  
      * Defines some internal constants used on this class.
 92  
      */
 93  0
     static class Constants {
 94  
             final static String ROOT_ELEMENT_NAME = "javaServiceConfiguration";
 95  
         final static String TYPE_NAME = "JavaServiceConfigurationType";
 96  
     }
 97  
 
 98  
     /**
 99  
      * A private class which exposes constants which define the XML element names to use
 100  
      * when this object is marshalled to XML.
 101  
      */
 102  0
     static class Elements {
 103  
             protected final static String SERVICE_INTERFACES = "serviceInterfaces";
 104  
             protected final static String SERVICE_INTERFACE = "serviceInterface";
 105  
     }
 106  
         
 107  
 }