Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritham Marupaka committed Jan 28, 2025
1 parent b59d006 commit c5fdef4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ private static Method getJsonCreatorStaticMethod(Type type) {
return null;
}

/**
* If {@code type} is a record with 0 components, return the canonical constructor.
*/
@Nullable
private static Constructor<?> getEmptyRecordCanonicalConstructor(Type type) {
if (type instanceof Class) {
Class<?> clazz = (Class<?>) type;
if (clazz.isRecord()) {
if (clazz.isRecord() && clazz.getRecordComponents().length == 0) {
for (Constructor<?> ctor : clazz.getDeclaredConstructors()) {
if (0 == ctor.getParameterCount()) {
return ctor;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
*
* 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.palantir.dialogue;

import com.palantir.logsafe.Safe;

public abstract class EndpointError<T> {
@Safe
private final String errorCode;

@Safe
private final String errorName;

@Safe
private final String errorInstanceId;

private final T params;

protected EndpointError(String errorCode, String errorName, String errorInstanceId, T params) {
this.errorCode = errorCode;
this.errorName = errorName;
this.errorInstanceId = errorInstanceId;
this.params = params;
}

public final String getErrorCode() {
return errorCode;
}

public final String getErrorName() {
return errorName;
}

public final String getErrorInstanceId() {
return errorInstanceId;
}

public final T getParams() {
return params;
}
}

0 comments on commit c5fdef4

Please sign in to comment.