Record Class EncryptedResult
java.lang.Object
java.lang.Record
cloud.opencode.base.web.crypto.EncryptedResult
- Record Components:
code- the result code | 响应码encryptedData- the encrypted data | 加密数据algorithm- the encryption algorithm | 加密算法timestamp- the timestamp | 时间戳traceId- the trace ID | 追踪ID
public record EncryptedResult(String code, String encryptedData, String algorithm, Instant timestamp, String traceId)
extends Record
Encrypted Result
加密响应
Response with encrypted data payload.
带加密数据负载的响应。
Features | 主要功能:
- Immutable encrypted result record - 不可变加密结果记录
- Algorithm and trace ID metadata - 算法和追踪ID元数据
- Timestamp tracking - 时间戳跟踪
Usage Examples | 使用示例:
EncryptedResult result = EncryptedResult.of("00000", encData, "AES-GCM");
boolean ok = result.isSuccess();
String data = result.encryptedData();
Security | 安全性:
- Thread-safe: Yes (immutable record) - 是(不可变记录)
- Null-safe: No (code and data should not be null) - 否(响应码和数据不应为null)
- Since:
- JDK 25, opencode-base-web V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord component.code()Returns the value of thecoderecord component.Returns the value of theencryptedDatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanCheck if success 检查是否成功static EncryptedResultCreate encrypted result 创建加密响应static EncryptedResultCreate encrypted result with trace ID 创建带追踪ID的加密响应Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.traceId()Returns the value of thetraceIdrecord component.
-
Constructor Details
-
EncryptedResult
public EncryptedResult(String code, String encryptedData, String algorithm, Instant timestamp, String traceId) Creates an instance of aEncryptedResultrecord class.- Parameters:
code- the value for thecoderecord componentencryptedData- the value for theencryptedDatarecord componentalgorithm- the value for thealgorithmrecord componenttimestamp- the value for thetimestamprecord componenttraceId- the value for thetraceIdrecord component
-
-
Method Details
-
of
Create encrypted result 创建加密响应- Parameters:
code- the result code | 响应码encryptedData- the encrypted data | 加密数据algorithm- the encryption algorithm | 加密算法- Returns:
- the encrypted result | 加密响应
-
of
public static EncryptedResult of(String code, String encryptedData, String algorithm, String traceId) Create encrypted result with trace ID 创建带追踪ID的加密响应- Parameters:
code- the result code | 响应码encryptedData- the encrypted data | 加密数据algorithm- the encryption algorithm | 加密算法traceId- the trace ID | 追踪ID- Returns:
- the encrypted result | 加密响应
-
isSuccess
public boolean isSuccess()Check if success 检查是否成功- Returns:
- true if success | 如果成功返回true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
code
-
encryptedData
Returns the value of theencryptedDatarecord component.- Returns:
- the value of the
encryptedDatarecord component
-
algorithm
-
timestamp
-
traceId
-