package org.argeo.api.gcr; import java.util.Map; /** * A semi-structured content, with attributes, within a hierarchical structure. */ public interface Content extends Iterable, Map { String getName(); // Iterable keys(); A get(String key, Class clss); ContentSession getSession(); /* * DEFAULT METHODS */ default A adapt(Class clss) { return null; } /* * CONVENIENCE METHODS */ default String attr(String key) { return get(key, String.class); } default String attr(Enum key) { return attr(key.name()); } default A get(Enum key, Class clss) { return get(key.name(), clss); } /* * EXPERIMENTAL UNSUPPORTED */ default boolean hasText() { return false; } default String getText() { throw new UnsupportedOperationException(); } }