io.xlate.edi.internal.schema.implementation.SegmentImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of staedi Show documentation
Show all versions of staedi Show documentation
Streaming API for EDI for Java
package io.xlate.edi.internal.schema.implementation;
import java.util.List;
import java.util.Objects;
import io.xlate.edi.schema.implementation.Discriminator;
import io.xlate.edi.schema.implementation.EDITypeImplementation;
import io.xlate.edi.schema.implementation.SegmentImplementation;
public class SegmentImpl extends BaseComplexImpl implements SegmentImplementation {
private static final String TOSTRING_FORMAT = "typeId: %s, code: %s, minOccurs: %d, maxOccurs: %d, discriminator: { %s }, sequence { %s }, standard: { %s }";
private final String code;
private final Discriminator discriminator;
@SuppressWarnings("java:S107")
public SegmentImpl(int minOccurs,
int maxOccurs,
String typeId,
String code,
Discriminator discriminator,
List sequence,
String title,
String description) {
super(sequence, title, description);
super.minOccurs = minOccurs;
super.maxOccurs = maxOccurs;
super.typeId = typeId;
this.code = code;
this.discriminator = discriminator;
}
@Override
public boolean equals(Object o) {
return super.equals(o) &&
Objects.equals(code, ((SegmentImpl) o).code) &&
Objects.equals(discriminator, ((SegmentImpl) o).discriminator);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), code, discriminator);
}
@Override
public String toString() {
return String.format(TOSTRING_FORMAT, typeId, code, minOccurs, maxOccurs, discriminator, sequence, standard);
}
@Override
public String getCode() {
return code;
}
@Override
public Discriminator getDiscriminator() {
return discriminator;
}
}