/** * Returns container child modification if {@code child} was modified by this modification. This method should be * used if the child is defined in a grouping brought into a case inside this object. * * <p> * For accessing all modified list items consider iterating over {@link #getModifiedChildren()}. * * @param caseType Case type class * @param child Type of child - must be only container * @return Modification of {@code child} if {@code child} was modified, null otherwise. * @throws IllegalArgumentException If supplied {@code child} class is not valid child according * to generated model. */ default @Nullable <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(@Nonnull final Class<H> caseType, @Nonnull final Class<C> child) { return (DataObjectModification<C>) getModifiedChild(Item.of(caseType, child)); }
/** * Returns child list item modification if {@code child} was modified by this modification. This method should be * used if the child is defined in a grouping brought into a case inside this object. * * @param caseType Case type class * @param childType Type of list item - must be list item with key * @return Modification of {@code child} if {@code child} was modified, null otherwise. * @throws IllegalArgumentException If supplied {@code childType} class is not valid child according * to generated model. */ default <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> Collection<DataObjectModification<C>> getModifiedChildren(@Nonnull final Class<H> caseType, @Nonnull final Class<C> childType) { final Item<C> item = Item.of(caseType, childType); return (Collection<DataObjectModification<C>>) Collections2.filter(getModifiedChildren(), mod -> item.equals(mod.getIdentifier())); }
/** * Create an instance identifier for a very specific object type. * * <p> * For example * <pre> * new InstanceIdentifier(Nodes.class) * </pre> * would create an InstanceIdentifier for an object of type Nodes * * @param type The type of the object which this instance identifier represents * @return InstanceIdentifier instance */ @SuppressWarnings("unchecked") public static <T extends DataObject> InstanceIdentifier<T> create(final Class<T> type) { return (InstanceIdentifier<T>) create(ImmutableList.of(Item.of(type))); }
/** * Create an InstanceIdentifierBuilder for a specific type of InstanceIdentifier as specified by container in * a {@code grouping} used in the {@code case} statement. * * @param caze Choice case class * @param container Base container * @param <C> Case type * @param <T> Type of the container * @return A new {@link InstanceIdentifierBuilder} * @throws NullPointerException if any argument is null */ public static <C extends ChoiceIn<? extends DataRoot> & DataObject, T extends ChildOf<? super C>> InstanceIdentifierBuilder<T> builder(final Class<C> caze, final Class<T> container) { return new InstanceIdentifierBuilderImpl<T>().addWildNode(Item.of(caze, container)); }
/** * Create an InstanceIdentifier for a child container. This method is a more efficient equivalent to * {@code builder().child(caze, container).build()}. * * @param caze Choice case class * @param container Container to append * @param <C> Case type * @param <N> Container type * @return An InstanceIdentifier. * @throws NullPointerException if any argument is null */ public final <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>> InstanceIdentifier<N> child( final Class<C> caze, final Class<N> container) { return childIdentifier(Item.of(caze, container)); }
private <N extends DataObject> InstanceIdentifierBuilderImpl<N> addNode(final Class<N> container) { return addWildNode(Item.of(container)); } }
/** * Create an InstanceIdentifier for a child augmentation. This method is a more efficient equivalent to * {@code builder().augmentation(container).build()}. * * @param container Container to append * @param <N> Container type * @return An InstanceIdentifier. * @throws NullPointerException if {@code container} is null */ public final <N extends DataObject & Augmentation<? super T>> InstanceIdentifier<N> augmentation( final Class<N> container) { return childIdentifier(Item.of(container)); }
@SuppressWarnings("unchecked") Item<?> createBindingArg(final Class<?> childClass, final DataSchemaNode childSchema) { return Item.of((Class<? extends DataObject>) childClass); }
@Override @SuppressWarnings("unchecked") public <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>> DataObjectModification<C> getModifiedChildContainer(final Class<H> caseType, final Class<C> child) { return (DataObjectModification<C>) getModifiedChild(Item.of(caseType, child)); }
@SuppressWarnings("unchecked") private DataContainerCodecPrototype(final Class<?> cls, final PathArgument arg, final T nodeSchema, final CodecContextFactory factory) { this(Item.of((Class<? extends DataObject>) cls), arg, nodeSchema, factory); }
@Override @SuppressWarnings("unchecked") public <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation( final Class<C> augmentation) { return (DataObjectModification<C>) getModifiedChild(Item.of(augmentation)); }
@Override public <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>> InstanceIdentifierBuilder<N> child(final Class<C> caze, final Class<N> container) { return addWildNode(Item.of(caze, container)); }
/** * Create a builder rooted at this key. * * @return A builder instance */ public InstanceIdentifierBuilder<T> builder() { return new InstanceIdentifierBuilderImpl<>(Item.of(targetType), pathArguments, hash, isWildcarded()); }
/** * Create an InstanceIdentifierBuilder for a specific type of InstanceIdentifier as specified by container. * * @param container Base container * @param <T> Type of the container * @return A new {@link InstanceIdentifierBuilder} * @throws NullPointerException if {@code container} is null */ public static <T extends ChildOf<? extends DataRoot>> InstanceIdentifierBuilder<T> builder( final Class<T> container) { return new InstanceIdentifierBuilderImpl<T>().addWildNode(Item.of(container)); }
@Override @SuppressWarnings("unchecked") public <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(final Class<C> child) { return (DataObjectModification<C>) getModifiedChild(Item.of(child)); }
/** * Create an InstanceIdentifier for a child container. This method is a more efficient equivalent to * {@code builder().child(container).build()}. * * @param container Container to append * @param <N> Container type * @return An InstanceIdentifier. * @throws NullPointerException if {@code container} is null */ public final <N extends ChildOf<? super T>> InstanceIdentifier<N> child(final Class<N> container) { return childIdentifier(Item.of(container)); }