com.casper.sdk.model.transaction.scheduling.FutureTimestamp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of casper-java-sdk Show documentation
Show all versions of casper-java-sdk Show documentation
SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.
The newest version!
package com.casper.sdk.model.transaction.scheduling;
import com.casper.sdk.exception.NoSuchTypeException;
import com.casper.sdk.model.clvalue.serde.Target;
import com.fasterxml.jackson.annotation.*;
import dev.oak3.sbs4j.SerializerBuffer;
import dev.oak3.sbs4j.exception.ValueSerializationException;
import lombok.*;
import org.joda.time.DateTime;
import java.util.Date;
/**
* Execution should be scheduled for the specified timestamp or later.
*
* @author [email protected]
*/
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
@Builder
@JsonTypeName("FutureTimestamp")
public class FutureTimestamp implements TransactionScheduling {
@JsonValue
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private String futureTimestamp;
@JsonIgnore
public Date asDate() {
return futureTimestamp != null ? new DateTime(futureTimestamp).toDate() : null;
}
@Override
public void serialize(final SerializerBuffer ser, final Target target) throws ValueSerializationException, NoSuchTypeException {
ser.writeU8(getByteTag());
ser.writeI64(asDate().getTime());
}
@Override
public byte getByteTag() {
return 2;
}
}