/**
 * Copyright (c) 2015 Bosch Software Innovations GmbH and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.hawkbit.autoconfigure.url;

import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.hawkbit.HawkbitServerProperties;
import org.eclipse.hawkbit.api.HostnameResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.common.base.Throwables;

/**
 * Autoconfiguration of the {@link HostnameResolver} based on a property.
 * 
 *
 *
 */
@Configuration
@EnableConfigurationProperties(HawkbitServerProperties.class)
public class PropertyHostnameResolverAutoConfiguration {

    @Autowired
    private HawkbitServerProperties serverProperties;

    /**
     * @return the default autoconfigure hostname resolver implementation which
     *         is property based specified by the property {@link #url}
     */
    @Bean
    @ConditionalOnMissingBean(value = HostnameResolver.class)
    public HostnameResolver hostnameResolver() {
        return new HostnameResolver() {
            @Override
            public URL resolveHostname() {
                try {
                    return new URL(serverProperties.getUrl());
                } catch (final MalformedURLException e) {
                    throw Throwables.propagate(e);
                }
            }
        };
    }

}

@@ -1515,102 +1515,16 @@
 urn 
-new HostnameResolver() %7B%0A            @Override%0A            public URL resolveHostname() %7B%0A    
+() -%3E %7B%0A
     
@@ -1549,28 +1549,24 @@
             
-    
 return new U
@@ -1596,20 +1596,16 @@
 Url());%0A
-    
         
@@ -1666,20 +1666,16 @@
         
-    
 throw Th
@@ -1701,26 +1701,8 @@
 e);%0A
-                %7D%0A
     

Convert to lambda