* invalid.
*/
public static ParticipantId toProxyParticipant(ParticipantId participant, String proxyFor)
throws InvalidParticipantAddress {
if (!Strings.isNullOrEmpty(proxyFor)) {
RobotName robotName = RobotName.fromAddress(participant.getAddress());
robotName.setProxyFor(proxyFor);
String robotAddress = robotName.toParticipantAddress();
if (!RobotName.isWellFormedAddress(robotAddress)) {
throw new InvalidParticipantAddress(robotAddress,
"is not a valid robot name, the proxy is likely to be wrong");
}
return ParticipantId.of(robotName.toParticipantAddress());
} else {
return participant;
}
}