All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.maps.gwt.client.UnitSystem Maven / Gradle / Ivy

/*
 * Copyright 2011 The Google Web Toolkit 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.google.maps.gwt.client;

import com.google.gwt.core.client.JavaScriptObject;
import java.util.HashMap;
import java.util.Map;

/**
 * The valid unit systems that can be specified in a 
 * DirectionsRequest
 * 
 * .
 *
 * THIS SOURCE CODE IS GENERATED, DO NOT MODIFY
 */
public class UnitSystem extends JavaScriptObject {

  /**
   * Specifies that distances in the 
   * DirectionsResult
   * 
   * should be expressed in imperial units.
   */ 
  public static final UnitSystem IMPERIAL = getImperial();

  /**
   * Specifies that distances in the 
   * DirectionsResult
   * 
   * should be expressed in metric units.
   */ 
  public static final UnitSystem METRIC = getMetric();

  /**
   * Internal registry for value types.
   */ 
  private static Map registry;

  /**
   * Access the enum instance using the underlying value of the type.
   */ 
  public static final UnitSystem fromValue(UnitSystem value){
    return registry.get(value);
  }

  /**
   * Internal initialization method.
   */ 
  private static final native UnitSystem getImperial()/*-{
    var instance = { 'value' : $wnd.google.maps.UnitSystem.IMPERIAL };
    @com.google.maps.gwt.client.UnitSystem::register(Lcom/google/maps/gwt/client/UnitSystem;)(instance);
    return instance;
  }-*/;

  /**
   * Internal initialization method.
   */ 
  private static final native UnitSystem getMetric()/*-{
    var instance = { 'value' : $wnd.google.maps.UnitSystem.METRIC };
    @com.google.maps.gwt.client.UnitSystem::register(Lcom/google/maps/gwt/client/UnitSystem;)(instance);
    return instance;
  }-*/;

  /**
   * Internal registration of type for future access.
   */ 
  private static final void register(UnitSystem value){
    if (registry == null) {
      registry = new HashMap();
    }
    registry.put(value.getValue(),value);
  }


  /**
   * Protected constructor avoids default public constructor.
   */
  protected UnitSystem() {
    /* Java constructor is protected, */
  }

  /**
   * Access the underlying value of the type.
   */ 
  public final native UnitSystem getValue()/*-{
    return this.value;
  }-*/;

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy