This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import com.google.protobuf.Message; | |
import io.grpc.Status; | |
import java.util.LinkedHashMap; | |
import java.util.Objects; | |
/** | |
* 特定のgRPCレスポンスのための例外クラスです。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import org.springframework.lang.Nullable; | |
import java.util.Locale; | |
/** | |
* テンプレート化されたメッセージの変換を扱います | |
*/ | |
public interface MessageResolver { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import com.google.protobuf.Message; | |
import java.util.HashSet; | |
import java.util.Set; | |
/** | |
* DetailMessageのためのユーティリティクラス |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import com.google.protobuf.Message; | |
import com.google.rpc.LocalizedMessage; | |
/** | |
* エラーメッセージの詳細を扱います | |
*/ | |
public interface DetailMessage { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import com.example.proto.grpc.exception.message.DetailMessage; | |
import com.example.proto.grpc.exception.message.MessageResolver; | |
import com.google.protobuf.Message; | |
import io.grpc.Status; | |
import java.util.Collections; | |
import java.util.Set; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import io.grpc.Status; | |
/** | |
* 特定のgRPCレスポンスのための例外クラスです。 | |
* | |
* @see org.springframework.web.server.ResponseStatusException | |
*/ | |
public class ResponseStatusException extends RuntimeException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.proto.grpc.exception.message; | |
import com.google.protobuf.Message; | |
import com.google.rpc.LocalizedMessage; | |
/** | |
* エラーメッセージの詳細を扱います | |
*/ | |
public interface DetailMessage { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Lengthwise { | |
length: number; | |
} | |
function loggingIdentity<T extends Lengthwise>(arg: T): T { | |
console.log(arg.length); | |
return arg; | |
} | |
loggingIdentity(['hello world']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ExampleInterface<T, U> { | |
value1: T; | |
value2: U; | |
} | |
const obj: ExampleInterface<string, number> = { value1: '文字列', value2: 1 }; | |
console.log(obj.value1); // 文字列 | |
console.log(obj.value2); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functionA = <T, U>(bool: boolean, param1: T, param2: U): T | U => { | |
if (bool) return param1; | |
return param2; | |
} | |
const result1 = functionA(true, 1, '文字列'); | |
const result2 = functionA(false, 1, '文字列'); | |
console.log(result1) // 1 | |
console.log(result2) // 文字列 |
NewerOlder