/**
 * This file is part of Everit - Component Metadata.
 *
 * Everit - Component Metadata is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Everit - Component Metadata is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Everit - Component Metadata.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.everit.osgi.ecm.metadata;

import java.util.Arrays;

public class ServiceMetadata {

    private final Class<?>[] clazzes;

    public ServiceMetadata() {
        this(null);
    }

    public ServiceMetadata(final Class<?>[] clazzes) {
        if (clazzes != null) {
            this.clazzes = Arrays.copyOf(clazzes, clazzes.length);
        } else {
            this.clazzes = null;
        }
    }

    public Class<?>[] getClazzes() {
        if (clazzes != null) {
            return Arrays.copyOf(clazzes, clazzes.length);
        } else {
            return null;
        }
    }
}

@@ -812,33 +812,8 @@
 a;%0A%0A
-import java.util.Arrays;%0A
 %0Apub
@@ -850,20 +850,67 @@
    p
+ublic static class ServiceMetadataBuilder %7B%0A        p
 rivate
- final
  Cla
@@ -927,24 +927,28 @@
 azzes;%0A%0A    
+ 
+   
 public Servi
@@ -957,16 +957,22 @@
 Metadata
+ build
 () %7B%0A   
@@ -980,31 +980,68 @@
     
+  
-this(null
+  return new ServiceMetadata(clazzes
 );%0A    
+  
+  
 %7D%0A%0A    
+   
+ 
 publ
@@ -1058,16 +1058,35 @@
 Metadata
+Builder withClazzes
 (final C
@@ -1106,32 +1106,36 @@
 zzes) %7B%0A        
+  
+  
 if (clazzes != n
@@ -1122,33 +1122,33 @@
     if (clazzes 
-!
+=
 = null) %7B%0A      
@@ -1145,32 +1145,36 @@
 ) %7B%0A            
+  
+  
 this.clazzes = A
@@ -1172,38 +1172,73 @@
 azzes = 
-Arrays.copyOf(
+null;%0A            %7D else %7B%0A                this.
 clazzes
-,
+ =
  clazzes
@@ -1230,38 +1230,38 @@
 azzes = clazzes.
-length
+clone(
 );%0A        %7D els
@@ -1251,32 +1251,54 @@
 ();%0A        
+ 
-%7D else %7B
+   %7D%0A            return this;
 %0A           
@@ -1298,42 +1298,144 @@
     
+%7D%0A%0A
     
-this.clazzes = null;%0A        %7D
+%7D%0A%0A    private final Class%3C?%3E%5B%5D clazzes;%0A%0A    private ServiceMetadata(final Class%3C?%3E%5B%5D clazzes) %7B%0A        this.clazzes = clazzes;
 %0A   
@@ -1529,45 +1529,22 @@
 urn 
-Arrays.copyOf(clazzes, clazzes.length
+clazzes.clone(
 );%0A 

Make builder for ServiceMetadata