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

com.hedera.node.app.service.token.impl.handlers.TokenGetNftInfosHandler Maven / Gradle / Ivy

There is a newer version: 0.56.6
Show newest version
/*
 * Copyright (C) 2022-2024 Hedera Hashgraph, LLC
 *
 * 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.hedera.node.app.service.token.impl.handlers;

import static com.hedera.hapi.node.base.ResponseCodeEnum.NOT_SUPPORTED;
import static java.util.Objects.requireNonNull;

import com.hedera.hapi.node.base.HederaFunctionality;
import com.hedera.hapi.node.base.QueryHeader;
import com.hedera.hapi.node.base.ResponseHeader;
import com.hedera.hapi.node.token.TokenGetNftInfosResponse;
import com.hedera.hapi.node.transaction.Query;
import com.hedera.hapi.node.transaction.Response;
import com.hedera.node.app.spi.workflows.FreeQueryHandler;
import com.hedera.node.app.spi.workflows.PreCheckException;
import com.hedera.node.app.spi.workflows.QueryContext;
import edu.umd.cs.findbugs.annotations.NonNull;
import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * This class contains all workflow-related functionality regarding {@link
 * HederaFunctionality#TOKEN_GET_NFT_INFOS}.
 * 

* This token service call has been deprecated. Because protobufs promise backwards compatibility, * we cannot remove it. However, it should not be used. */ @Singleton public class TokenGetNftInfosHandler extends FreeQueryHandler { /** * Default constructor for injection. */ @Inject public TokenGetNftInfosHandler() { // Exists for injection } @Override public QueryHeader extractHeader(@NonNull final Query query) { requireNonNull(query); return query.tokenGetNftInfosOrThrow().header(); } @Override public Response createEmptyResponse(@NonNull final ResponseHeader header) { requireNonNull(header); final var response = TokenGetNftInfosResponse.newBuilder().header(requireNonNull(header)); return Response.newBuilder().tokenGetNftInfos(response).build(); } @Override public void validate(@NonNull final QueryContext context) throws PreCheckException { requireNonNull(context); throw new PreCheckException(NOT_SUPPORTED); } @Override public Response findResponse(@NonNull final QueryContext context, @NonNull final ResponseHeader header) { // this code never runs, since validate fails every time requireNonNull(context); requireNonNull(header); throw new UnsupportedOperationException(NOT_SUPPORTED.toString()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy