}
Preconditions.checkArgument(a != null, "pathArguments may not be empty");
- return trustedCreate(a, pathArguments, hashBuilder.toInstance(), wildcard);
+ return trustedCreate(a, pathArguments, hashBuilder.build(), wildcard);
}
/**
*
* @param id instance identifier
* @return key associated with the last component
+ * @throws IllegalArgumentException if the supplied identifier type cannot have a key.
+ * @throws NullPointerException if id is null.
*/
public static <N extends Identifiable<K> & DataObject, K extends Identifier<N>> K keyOf(final InstanceIdentifier<N> id) {
+ Preconditions.checkNotNull(id);
+ Preconditions.checkArgument(id instanceof KeyedInstanceIdentifier, "%s does not have a key", id);
+
@SuppressWarnings("unchecked")
final K ret = ((KeyedInstanceIdentifier<N, K>)id).getKey();
return ret;
* @return
*/
InstanceIdentifier<T> build();
+
+ /*
+ * @deprecated use #build()
+ */
+ @Deprecated
+ InstanceIdentifier<T> toInstance();
}
private void writeObject(final java.io.ObjectOutputStream out) throws IOException {