public abstract class

GetPropertyRequest

extends java.lang.Object

 java.lang.Object

↳androidx.car.app.hardware.common.GetPropertyRequest

Gradle dependencies

compile group: 'androidx.car.app', name: 'app-automotive', version: '1.7.0-beta01'

  • groupId: androidx.car.app
  • artifactId: app-automotive
  • version: 1.7.0-beta01

Artifact androidx.car.app:app-automotive:1.7.0-beta01 it located at Google repository (https://maven.google.com/)

Overview

Container class for information about getting property values.

submits this request to PropertyManager for getting property values.

Summary

Constructors
publicGetPropertyRequest()

Methods
public static GetPropertyRequest.Builderbuilder()

Get a GetPropertyRequest.Builder for creating the GetPropertyRequest.

public static GetPropertyRequestcreate(int propertyId)

Creates a request with CarZone.CAR_ZONE_GLOBAL.

public abstract <any>getCarZones()

Returns a list of CarZones associated with this request.

public abstract intgetPropertyId()

Returns one of the values in .

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public GetPropertyRequest()

Methods

public static GetPropertyRequest create(int propertyId)

Creates a request with CarZone.CAR_ZONE_GLOBAL.

Parameters:

propertyId: one of the values in

public abstract int getPropertyId()

Returns one of the values in .

public abstract <any> getCarZones()

Returns a list of CarZones associated with this request.

public static GetPropertyRequest.Builder builder()

Get a GetPropertyRequest.Builder for creating the GetPropertyRequest.

Source

/*
 * Copyright 2021 The Android Open Source Project
 *
 * 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 androidx.car.app.hardware.common;

import static androidx.annotation.RestrictTo.Scope.LIBRARY;

import androidx.annotation.NonNull;
import androidx.annotation.OptIn;
import androidx.annotation.RestrictTo;
import androidx.car.app.annotations.ExperimentalCarApi;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;

import java.util.Collections;
import java.util.List;

/**
 * Container class for information about getting property values.
 *
 * <P>submits this request to {@link PropertyManager} for getting property values.
 *
 */
@AutoValue
@RestrictTo(LIBRARY)
public abstract class GetPropertyRequest {
    /**
     * Creates a request with {@link CarZone#CAR_ZONE_GLOBAL}.
     *
     * @param propertyId    one of the values in {@link android.car.VehiclePropertyIds}
     */
    @NonNull
    public static GetPropertyRequest create(int propertyId) {
        return builder().setPropertyId(propertyId).build();
    }

    /** Returns one of the values in {@link android.car.VehiclePropertyIds}. */
    public abstract int getPropertyId();

    /** Returns a list of {@link CarZone}s associated with this request.  */
    @NonNull
    public abstract ImmutableList<CarZone> getCarZones();

    /** Get a {@link Builder} for creating the {@link GetPropertyRequest}. */
    @NonNull
    @OptIn(markerClass = ExperimentalCarApi.class)
    public static Builder builder() {
        return new AutoValue_GetPropertyRequest.Builder()
                .setCarZones(Collections.singletonList(CarZone.CAR_ZONE_GLOBAL));
    }

    /** A builder for the {@link GetPropertyRequest}. */
    @AutoValue.Builder
    public abstract static class Builder {
        /** Sets a property ID for the {@link GetPropertyRequest}. */
        @NonNull
        public abstract Builder setPropertyId(int propertyId);

        /** Sets a list of {@link CarZone}s for the {@link GetPropertyRequest}. */
        @NonNull
        public abstract Builder setCarZones(@NonNull List<CarZone> carZones);

        /** Creates an instance of {@link GetPropertyRequest}. */
        @NonNull
        public abstract GetPropertyRequest build();
    }

}