com.ionoscloud.s3.messages.AndOperator 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 java.util.Collections;
import java.util.Map;
import javax.annotation.Nullable;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementMap;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.convert.Convert;
/** Helper class to denote AND operator information for {@link RuleFilter}. */
@Root(name = "And")
public class AndOperator {
@Element(name = "Prefix", required = false)
@Convert(PrefixConverter.class)
private String prefix;
@ElementMap(
attribute = false,
entry = "Tag",
inline = true,
key = "Key",
value = "Value",
required = false)
private Map tags;
public AndOperator(
@Nullable @Element(name = "Prefix", required = false) String prefix,
@Nullable
@ElementMap(
attribute = false,
entry = "Tag",
inline = true,
key = "Key",
value = "Value",
required = false)
Map tags) {
if (prefix == null && tags == null) {
throw new IllegalArgumentException("At least Prefix or Tags must be set");
}
if (tags != null) {
for (String key : tags.keySet()) {
if (key.isEmpty()) {
throw new IllegalArgumentException("Tags must not contain empty key");
}
}
}
this.prefix = prefix;
this.tags = (tags != null) ? Collections.unmodifiableMap(tags) : null;
}
public String prefix() {
return this.prefix;
}
public Map tags() {
return this.tags;
}
}