// Path: src/main/java/com/github/jmnarloch/spring/jaxrs/client/support/JaxRsClientRegistrar.java
// public class JaxRsClientRegistrar implements ImportBeanDefinitionRegistrar {
// 
//     /**
//      * The annotation class.
//      */
//     private static final Class<EnableJaxRsClient> ANNOTATION_CLASS = EnableJaxRsClient.class;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @SuppressWarnings("unchecked")
//     @Override
//     public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
// 
//         final List<String> basePackages = new ArrayList<String>();
//         final Map<String, Object> attributes = annotationMetadata
//                 .getAnnotationAttributes(ANNOTATION_CLASS.getName(), false);
// 
//         final Class<? extends ServiceUrlProvider> serviceUrlProvider = get(attributes, "serviceUrlProvider");
//         final String serviceUrl = get(attributes, "serviceUrl");
// 
//         addAll(basePackages, attributes, "value");
//         addAll(basePackages, attributes, "basePackages");
//         addAll(basePackages, toPackageNames((Class[]) attributes.get("basePackageClasses")));
// 
//         final JaxRsClientClassPathScanner scanner = new JaxRsClientClassPathScanner(registry);
//         scanner.setServiceUrl(serviceUrl);
//         scanner.setServiceUrlProvider(serviceUrlProvider);
//         scanner.scan(toArray(basePackages));
//     }
// 
//     /**
//      * Retrieves the attribute by it's name
//      *
//      * @param attributes    the attribute map
//      * @param attributeName the attribute name
//      * @param <T>           the attribute type
//      * @return the attribute value
//      */
//     @SuppressWarnings("unchecked")
//     private static <T> T get(Map<String, Object> attributes, String attributeName) {
//         return (T) attributes.get(attributeName);
//     }
// 
//     /**
//      * Retrieves the array of package names for each of the individual class.
//      *
//      * @param basePackageClasses the base package classes
//      * @return the array of package names
//      */
//     private static String[] toPackageNames(Class[] basePackageClasses) {
//         final String[] packages = new String[basePackageClasses.length];
//         for (int ind = 0; ind < basePackageClasses.length; ind++) {
//             packages[ind] = basePackageClasses[ind].getPackage().getName();
//         }
//         return packages;
//     }
// 
//     /**
//      * Adds all values associated with the given attribute.
//      *
//      * @param list          the list of values
//      * @param attributes    the attributes map
//      * @param attributeName the attribute name
//      */
//     private static void addAll(List<String> list, Map<String, Object> attributes, String attributeName) {
//         addAll(list, (String[]) get(attributes, attributeName));
//     }
// 
//     /**
//      * Ads all values to the value list.
//      *
//      * @param list   the list of values
//      * @param values the values
//      */
//     private static void addAll(List<String> list, String[] values) {
//         list.addAll(Arrays.asList(values));
//     }
// 
//     /**
//      * Converts the list into the array.
//      *
//      * @param list the list
//      * @return the array
//      */
//     private static String[] toArray(List<String> list) {
//         return list.toArray(new String[list.size()]);
//     }
// }


import com.github.jmnarloch.spring.jaxrs.client.support.JaxRsClientRegistrar;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
/**
 * Copyright (c) 2015 the original author or authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.jmnarloch.spring.jaxrs.client.annotation;



/**
 * Enables the proxy client generation of specific class path scanned interfaces.
 *
 * Each interface annotated with {@link javax.ws.rs.Path} will be wrapped into proxy client class and registered in the
 * {@link ApplicationContext}.
 *
 * @author Jakub Narloch
 * @see com.github.jmnarloch.spring.jaxrs.client.resteasy.EnableRestEasyClient
 * @see com.github.jmnarloch.spring.jaxrs.client.cxf.EnableCxfClient
 * @see com.github.jmnarloch.spring.jaxrs.client.jersey.EnableJerseyClient
 */
@Import(JaxRsClientRegistrar.class)
@Target(ElementType.TYPE)
// Path: src/main/java/com/github/jmnarloch/spring/jaxrs/client/support/JaxRsClientRegistrar.java
// public class JaxRsClientRegistrar implements ImportBeanDefinitionRegistrar {
// 
//     /**
//      * The annotation class.
//      */
//     private static final Class<EnableJaxRsClient> ANNOTATION_CLASS = EnableJaxRsClient.class;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @SuppressWarnings("unchecked")
//     @Override
//     public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry registry) {
// 
//         final List<String> basePackages = new ArrayList<String>();
//         final Map<String, Object> attributes = annotationMetadata
//                 .getAnnotationAttributes(ANNOTATION_CLASS.getName(), false);
// 
//         final Class<? extends ServiceUrlProvider> serviceUrlProvider = get(attributes, "serviceUrlProvider");
//         final String serviceUrl = get(attributes, "serviceUrl");
// 
//         addAll(basePackages, attributes, "value");
//         addAll(basePackages, attributes, "basePackages");
//         addAll(basePackages, toPackageNames((Class[]) attributes.get("basePackageClasses")));
// 
//         final JaxRsClientClassPathScanner scanner = new JaxRsClientClassPathScanner(registry);
//         scanner.setServiceUrl(serviceUrl);
//         scanner.setServiceUrlProvider(serviceUrlProvider);
//         scanner.scan(toArray(basePackages));
//     }
// 
//     /**
//      * Retrieves the attribute by it's name
//      *
//      * @param attributes    the attribute map
//      * @param attributeName the attribute name
//      * @param <T>           the attribute type
//      * @return the attribute value
//      */
//     @SuppressWarnings("unchecked")
//     private static <T> T get(Map<String, Object> attributes, String attributeName) {
//         return (T) attributes.get(attributeName);
//     }
// 
//     /**
//      * Retrieves the array of package names for each of the individual class.
//      *
//      * @param basePackageClasses the base package classes
//      * @return the array of package names
//      */
//     private static String[] toPackageNames(Class[] basePackageClasses) {
//         final String[] packages = new String[basePackageClasses.length];
//         for (int ind = 0; ind < basePackageClasses.length; ind++) {
//             packages[ind] = basePackageClasses[ind].getPackage().getName();
//         }
//         return packages;
//     }
// 
//     /**
//      * Adds all values associated with the given attribute.
//      *
//      * @param list          the list of values
//      * @param attributes    the attributes map
//      * @param attributeName the attribute name
//      */
//     private static void addAll(List<String> list, Map<String, Object> attributes, String attributeName) {
//         addAll(list, (String[]) get(attributes, attributeName));
//     }
// 
//     /**
//      * Ads all values to the value list.
//      *
//      * @param list   the list of values
//      * @param values the values
//      */
//     private static void addAll(List<String> list, String[] values) {
//         list.addAll(Arrays.asList(values));
//     }
// 
//     /**
//      * Converts the list into the array.
//      *
//      * @param list the list
//      * @return the array
//      */
//     private static String[] toArray(List<String> list) {
//         return list.toArray(new String[list.size()]);
//     }
// }


// Path: src/main/java/com/github/jmnarloch/spring/jaxrs/client/annotation/EnableJaxRsClient.java
import com.github.jmnarloch.spring.jaxrs.client.support.JaxRsClientRegistrar;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;

/**
 * Copyright (c) 2015 the original author or authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.jmnarloch.spring.jaxrs.client.annotation;



/**
 * Enables the proxy client generation of specific class path scanned interfaces.
 *
 * Each interface annotated with {@link javax.ws.rs.Path} will be wrapped into proxy client class and registered in the
 * {@link ApplicationContext}.
 *
 * @author Jakub Narloch
 * @see com.github.jmnarloch.spring.jaxrs.client.resteasy.EnableRestEasyClient
 * @see com.github.jmnarloch.spring.jaxrs.client.cxf.EnableCxfClient
 * @see com.github.jmnarloch.spring.jaxrs.client.jersey.EnableJerseyClient
 */
@Import(JaxRsClientRegistrar.class)
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)