com.regnosys.rosetta.translate.synonymmap.SynonymPathTest Maven / Gradle / Ivy
package com.regnosys.rosetta.translate.synonymmap;
import com.regnosys.rosetta.rosetta.RosettaMapPath;
import com.regnosys.rosetta.rosetta.RosettaMapPathValue;
import java.util.Collections;
import java.util.List;
public class SynonymPathTest implements SynonymTest {
private final String path;
public SynonymPathTest(RosettaMapPath exp) {
path = ((RosettaMapPathValue) exp.getPath()).getPath();
}
@Override
public TestPriority priority() {
return TestPriority.Last;
}
@Override
public List getPaths() {
return Collections.emptyList();
}
public String getPathWithDots() {
if (path != null && path.contains(PATH_SEPARATOR)) {
return path.replaceAll(PATH_SEPARATOR, ".");
}
return path;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((path == null) ? 0 : path.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SynonymPathTest other = (SynonymPathTest) obj;
if (path == null) {
if (other.path != null)
return false;
} else if (!path.equals(other.path))
return false;
return true;
}
}