X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api%2Fsrc%2Forg%2Fargeo%2Fapi%2Fgcr%2FContent.java;fp=org.argeo.api%2Fsrc%2Forg%2Fargeo%2Fapi%2Fgcr%2FContent.java;h=c5cee9f0e6676495acd7f791a98204bec9f6c8d8;hb=06af25d84c049b149ee9db2235faeff3170b4f7e;hp=0000000000000000000000000000000000000000;hpb=b7683883512d924a039a43c2e1102290aa49f64d;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.api/src/org/argeo/api/gcr/Content.java b/org.argeo.api/src/org/argeo/api/gcr/Content.java new file mode 100644 index 000000000..c5cee9f0e --- /dev/null +++ b/org.argeo.api/src/org/argeo/api/gcr/Content.java @@ -0,0 +1,48 @@ +package org.argeo.api.gcr; + +import java.util.Map; + +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(); + } + +}