mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-31 05:18:18 +00:00
32 lines
975 B
Java
32 lines
975 B
Java
//
|
|
// Source code recreated from a .class file by IntelliJ IDEA
|
|
// (powered by FernFlower decompiler)
|
|
//
|
|
|
|
package com.linkedin.common.urn;
|
|
|
|
import com.linkedin.data.template.DirectCoercer;
|
|
import com.linkedin.data.template.TemplateOutputCastException;
|
|
import java.net.URISyntaxException;
|
|
|
|
public class UrnCoercer implements DirectCoercer<Urn> {
|
|
public UrnCoercer() {
|
|
}
|
|
|
|
public Object coerceInput(Urn object) throws ClassCastException {
|
|
return object.toString();
|
|
}
|
|
|
|
public Urn coerceOutput(Object object) throws TemplateOutputCastException {
|
|
if (object.getClass() != String.class) {
|
|
throw new TemplateOutputCastException("Urn not backed by String");
|
|
} else {
|
|
try {
|
|
return Urn.createFromString((String)object);
|
|
} catch (URISyntaxException use) {
|
|
throw new TemplateOutputCastException("Invalid URN syntax: " + use.getMessage(), use);
|
|
}
|
|
}
|
|
}
|
|
}
|