@SuppressWarnings("unchecked") public static <Type extends DocumentNode> Type getOtherVersion( Type documentNode, Version version) { if (documentNode.getVersion() == version) { return documentNode; } else { for (DocumentNode otherVersion : documentNode.getOtherVersions()) { if (otherVersion.getVersion() == version) { return (Type) otherVersion; } } return null; } }
public static void setVersion(DocumentNode node, Version version) { node.setVersion(version); }