Reference keyRef = KeyTranslator.convertToPb((Key) value);
setPropertyValue(propertyValue, keyRef);
}
private static void setPropertyValue(PropertyValue propertyValue, Reference keyRef) {
ReferenceValue refValue = new ReferenceValue();
refValue.setApp(keyRef.getApp());
if (keyRef.hasNameSpace()) {
refValue.setNameSpace(keyRef.getNameSpace());
}
Path path = keyRef.getPath();
for (Element element : path.elements()) {
ReferenceValuePathElement newElement = new ReferenceValuePathElement();
newElement.setType(element.getType());
if (element.hasName()) {
newElement.setName(element.getName());
}
if (element.hasId()) {
newElement.setId(element.getId());
}
refValue.addPathElement(newElement);
}
propertyValue.setReferenceValue(refValue);
}