Forcing users of builder to not reuse PathArgument instances seems
wrong. Allow passing of pre-made PathArguments to a builder.
Change-Id: Iae7d2a8c8dd60542a11c946dc3ced18e09afb62b
Signed-off-by: Robert Varga <rovarga@cisco.com>
* Fluent Builder of Instance Identifier instances
*/
public interface InstanceIdentifierBuilder extends Builder<YangInstanceIdentifier> {
+ /**
+ * Adds a {@link PathArgument} to to path arguments of resulting instance identifier.
+ *
+ * @param arg A {@link PathArgument} to be added
+ * @return this builder
+ */
+ InstanceIdentifierBuilder node(PathArgument arg);
+
/**
* Adds {@link NodeIdentifier} with supplied QName to path arguments of resulting instance identifier.
*
*/
package org.opendaylight.yangtools.yang.data.api;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
return this;
}
+ @Override
+ public InstanceIdentifierBuilder node(final PathArgument arg) {
+ return addArgument(Preconditions.checkNotNull(arg));
+ }
+
@Override
public InstanceIdentifierBuilder node(final QName nodeType) {
return addArgument(new NodeIdentifier(nodeType));