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

com.azure.core.implementation.GeoObjectHelper Maven / Gradle / Ivy

There is a newer version: 1.54.1
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.core.implementation;

import com.azure.core.models.GeoObject;

import java.util.Map;

/**
 * Helper class to access private values of {@link GeoObject} across package boundaries.
 */
public final class GeoObjectHelper {
    private static GeoObjectAccessor accessor;

    private GeoObjectHelper() { }

    /**
     * Type defining the methods to set the non-public properties of an {@link GeoObjectHelper} instance.
     */
    public interface GeoObjectAccessor {
        /**
         * Gets the custom properties of the passed {@link GeoObject}.
         *
         * @param geoObject The {@link GeoObject} used to get custom properties.
         * @return The custom properties of the {@link GeoObject}.
         */
        Map getCustomProperties(GeoObject geoObject);
    }

    /**
     * The method called from {@link GeoObject} to set its accessor.
     *
     * @param geoObjectAccessor The accessor.
     */
    public static void setAccessor(final GeoObjectAccessor geoObjectAccessor) {
        accessor = geoObjectAccessor;
    }

    /**
     * Gets the custom properties of the passed {@link GeoObject}.
     *
     * @param geoObject The {@link GeoObject} used to get custom properties.
     * @return The custom properties of the {@link GeoObject}.
     */
    public static Map getCustomProperties(GeoObject geoObject) {
        return accessor.getCustomProperties(geoObject);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy