/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.proxy;

import alluxio.conf.ServerConfiguration;
import alluxio.conf.ConfigurationValueOptions;
import alluxio.RestUtils;
import alluxio.RuntimeConstants;
import alluxio.web.ProxyWebServer;
import alluxio.wire.AlluxioProxyInfo;

import com.qmino.miredot.annotations.ReturnType;

import java.util.Map;
import java.util.TreeMap;

import javax.annotation.concurrent.NotThreadSafe;
import javax.servlet.ServletContext;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 * This class is a REST handler for requesting general proxy information.
 */
@NotThreadSafe
@Path(AlluxioProxyRestServiceHandler.SERVICE_PREFIX)
@Produces(MediaType.APPLICATION_JSON)
public final class AlluxioProxyRestServiceHandler {
  public static final String SERVICE_PREFIX = "proxy";

  // endpoints
  public static final String GET_INFO = "info";

  // queries
  public static final String QUERY_RAW_CONFIGURATION = "raw_configuration";

  private final ProxyProcess mProxyProcess;

  /**
   * Constructs a new {@link AlluxioProxyRestServiceHandler}.
   *
   * @param context context for the servlet
   */
  public AlluxioProxyRestServiceHandler(@Context ServletContext context) {
    // Poor man's dependency injection through the Jersey application scope.
    mProxyProcess = (ProxyProcess) context
        .getAttribute(ProxyWebServer.ALLUXIO_PROXY_SERVLET_RESOURCE_KEY);
  }

  /**
   * @summary get the Alluxio proxy information
   * @param rawConfiguration if it's true, raw configuration values are returned,
   *    otherwise, they are looked up; if it's not provided in URL queries, then
   *    it is null, which means false.
   * @return the response object
   */
  @GET
  @Path(GET_INFO)
  @ReturnType("alluxio.wire.AlluxioProxyInfo")
  public Response getInfo(@QueryParam(QUERY_RAW_CONFIGURATION) final Boolean rawConfiguration) {
    // TODO(jiri): Add a mechanism for retrieving only a subset of the fields.
    return RestUtils.call(new RestUtils.RestCallable<AlluxioProxyInfo>() {
      @Override
      public AlluxioProxyInfo call() throws Exception {
        boolean rawConfig = false;
        if (rawConfiguration != null) {
          rawConfig = rawConfiguration;
        }
        AlluxioProxyInfo result =
            new AlluxioProxyInfo()
                .setConfiguration(getConfigurationInternal(rawConfig))
                .setStartTimeMs(mProxyProcess.getStartTimeMs())
                .setUptimeMs(mProxyProcess.getUptimeMs())
                .setVersion(RuntimeConstants.VERSION);
        return result;
      }
    }, ServerConfiguration.global());
  }

  private Map<String, String> getConfigurationInternal(boolean raw) {
    return new TreeMap<>(ServerConfiguration
        .toMap(ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(raw)));
  }
}

@@ -2615,131 +2615,16 @@
 all(
-new RestUtils.RestCallable%3CAlluxioProxyInfo%3E() %7B%0A      @Override%0A      public AlluxioProxyInfo call() throws Exception
+() -%3E
  %7B%0A
-  
     
@@ -2658,18 +2658,16 @@
 ;%0A      
- 
- 
 if (rawC
@@ -2698,18 +2698,16 @@
         
-  
 rawConfi
@@ -2728,18 +2728,16 @@
 ration;%0A
-  
       %7D%0A
@@ -2742,18 +2742,16 @@
 %7D%0A      
-  
 AlluxioP
@@ -2768,18 +2768,16 @@
 esult =%0A
-  
         
@@ -2811,26 +2811,24 @@
             
-  
 .setConfigur
@@ -2880,26 +2880,24 @@
             
-  
 .setStartTim
@@ -2942,26 +2942,24 @@
             
- 
- 
 .setUptimeMs
@@ -2998,26 +2998,24 @@
             
-  
 .setVersion(
@@ -3047,18 +3047,16 @@
 ;%0A      
- 
- 
 return r
@@ -3062,24 +3062,16 @@
 result;%0A
-      %7D%0A
     %7D, S

Replace anonymous type with lambda