us.bpsm.edn.parser.UuidHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edn-java Show documentation
Show all versions of edn-java Show documentation
edn-java is an parser and printer for 'edn' written in Java, for Java and
requiring no external dependencies.
// (c) 2012 B Smith-Mannschott -- Distributed under the Eclipse Public License
package us.bpsm.edn.parser;
import java.util.UUID;
import us.bpsm.edn.EdnSyntaxException;
import us.bpsm.edn.Tag;
class UuidHandler implements TagHandler {
public Object transform(Tag tag, Object value) {
if (!(value instanceof String)) {
throw new EdnSyntaxException(tag.toString() +
" expectes a String.");
}
return UUID.fromString((String) value);
}
}