org.opendaylight.yangtools.binding.impl.DataObjectReferenceBuilder Maven / Gradle / Ivy
/*
* Copyright (c) 2024 PANTHEON.tech, s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yangtools.binding.impl;
import org.opendaylight.yangtools.binding.DataObject;
import org.opendaylight.yangtools.binding.DataObjectReference;
import org.opendaylight.yangtools.binding.DataObjectStep;
import org.opendaylight.yangtools.binding.EntryObject;
import org.opendaylight.yangtools.binding.Key;
import org.opendaylight.yangtools.binding.KeyStep;
public final class DataObjectReferenceBuilder extends AbstractDataObjectReferenceBuilder {
DataObjectReferenceBuilder(final AbstractDataObjectReferenceBuilder> prev) {
super(prev);
}
DataObjectReferenceBuilder(final DataObjectReference base) {
super(base);
}
public DataObjectReferenceBuilder(final DataObjectStep> item) {
super(item);
}
@Override
public DataObjectReference build() {
final var steps = buildSteps();
return wildcard() ? new DataObjectReferenceImpl<>(steps) : new DataObjectIdentifierImpl<>(null, steps);
}
@Override
@SuppressWarnings("unchecked")
protected DataObjectReferenceBuilder append(final DataObjectStep step) {
appendItem(step);
return (DataObjectReferenceBuilder) this;
}
@Override
protected , Y extends Key> DataObjectReferenceBuilderWithKey append(
final KeyStep step) {
return new DataObjectReferenceBuilderWithKey(this).append(step);
}
}