io.datahubproject.models.util.ContainerKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datahub-client-java8 Show documentation
Show all versions of datahub-client-java8 Show documentation
DataHub Java client for metadata integration
The newest version!
package io.datahubproject.models.util;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.linkedin.common.urn.Urn;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public abstract class ContainerKey extends DataHubKey {
private String platform;
private String instance;
private static final String URN_PREFIX = "urn:li:container:";
private static final String URN_ENTITY = "container";
private static final String PLATFORM_MAP_FIELD = "platform";
private static final String INSTANCE_MAP_FIELD = "instance";
@Override
public Map guidDict() {
Map bag = new HashMap<>();
if (platform != null) bag.put(PLATFORM_MAP_FIELD, platform);
if (instance != null) bag.put(INSTANCE_MAP_FIELD, instance);
return bag;
}
public String asUrnString() {
String guid = guid();
return URN_PREFIX + guid;
}
public Urn asUrn() {
return Urn.createFromTuple(URN_ENTITY, guid());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy