com.regnosys.rosetta.translate.datamodel.Entity Maven / Gradle / Ivy
package com.regnosys.rosetta.translate.datamodel;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import com.regnosys.rosetta.common.util.StreamUtils;
/**
* @author TomForwood
*
*/
public interface Entity {
NamespaceName getName();
List getAttributes();
void addAttribute(Attribute att);
Entity getExtendedEntity();
List getKnownExtendingEntities();
default Stream getAllPossibleAttributes() {
return StreamUtils.flattenTreeC(this, e -> e.getKnownExtendingEntities())
.flatMap(e -> e.getAttributes().stream()).distinct();
}
boolean hasChild();
boolean hasData();
/**
* @param alreadyWritten - names of entities that have already been written to
* prevent cycles in the recursion
* @return a string representation of this entity that doesn't contain cycles
*/
String toString(Set alreadyWritten);
}