cdc.mf.model.MfCardinalityItem Maven / Gradle / Ivy
The newest version!
package cdc.mf.model;
/**
* Interface of elements that have an optional {@link MfCardinality cardinality}.
*
* @author Damien Carbonne
*/
public interface MfCardinalityItem extends MfElement {
/**
* @return The element {@link MfCardinality cardinality}.
*/
public MfCardinality getCardinality();
/**
* @return {@code true} if this element has a cardinality.
*/
public default boolean hasCardinality() {
return getCardinality() != null;
}
/**
* @return The effective cardinality, that is the cardinality if it exists,
* or {@link MfCardinality#ONE ONE} otherwise.
*/
public default MfCardinality getEffectiveCardinality() {
return getCardinality() == null
? MfCardinality.ONE
: getCardinality();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy