com.ionoscloud.s3.messages.RetentionDurationYears Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ionos-cloud-sdk-s3 Show documentation
Show all versions of ionos-cloud-sdk-s3 Show documentation
IONOS Java SDK for Amazon S3 Compatible Cloud Storage
The newest version!
package com.ionoscloud.s3.messages;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Text;
/** Years type retention duration of {@link ObjectLockConfiguration} */
@Root(name = "Years")
public class RetentionDurationYears implements RetentionDuration {
@Text(required = false)
private Integer years;
public RetentionDurationYears() {}
public RetentionDurationYears(int years) {
this.years = Integer.valueOf(years);
}
public RetentionDurationUnit unit() {
return RetentionDurationUnit.YEARS;
}
public int duration() {
return years;
}
/** Returns RetentionDurationYears as string. */
@Override
public String toString() {
if (years == null) {
return "";
}
return years.toString() + ((years == 1) ? " year" : " years");
}
}