X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.api.acr%2Fsrc%2Forg%2Fargeo%2Fapi%2Facr%2FAttributeFormatter.java;h=9f338965f829d2781649cb7fe192f9e2afa11a28;hb=9e6715d360fb29bb817ecaf6d49f0c8a3cc014f5;hp=41600331a21b756b634280c09ef70ab40aeb7af1;hpb=fba42be03bc7ec07d464f8942f7dfa2e5f0d6f17;p=lgpl%2Fargeo-commons.git
diff --git a/org.argeo.api.acr/src/org/argeo/api/acr/AttributeFormatter.java b/org.argeo.api.acr/src/org/argeo/api/acr/AttributeFormatter.java
index 41600331a..9f338965f 100644
--- a/org.argeo.api.acr/src/org/argeo/api/acr/AttributeFormatter.java
+++ b/org.argeo.api.acr/src/org/argeo/api/acr/AttributeFormatter.java
@@ -1,16 +1,25 @@
package org.argeo.api.acr;
+import javax.xml.namespace.NamespaceContext;
+
/**
* An attribute type MUST consistently parse a string to an object so that
* parse(obj.toString()).equals(obj)
is verified.
* {@link #format(Object)} can be overridden to provide more efficient
- * implementations but the returned
- * String MUST be the same, that is format(obj).equals(obj.toString())
- * is verified.
+ * implementations but the returned String
MUST be the same, that
+ * is format(obj).equals(obj.toString())
is verified.
*/
public interface AttributeFormatter {
/** Parses a String to a Java object. */
- T parse(String str) throws IllegalArgumentException;
+ default T parse(String str) throws IllegalArgumentException {
+ return parse(RuntimeNamespaceContext.getNamespaceContext(), str);
+ }
+
+ /**
+ * Parses a String to a Java object, possibly using the namespace context to
+ * resolve QName or CURIE.
+ */
+ T parse(NamespaceContext namespaceContext, String str) throws IllegalArgumentException;
/** Default implementation returns {@link Object#toString()} on the argument. */
default String format(T obj) {