*/
package org.opendaylight.yangtools.yang.model.api.stmt;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import static com.google.common.base.Verify.verifyNotNull;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-public interface BitStatement extends DeclaredStatement<QName>, DocumentationGroup.WithStatus {
+public interface BitStatement extends DocumentedDeclaredStatement.WithStatus<QName>,
+ IfFeatureAwareDeclaredStatement<QName> {
+ default @NonNull String getName() {
+ // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here
+ return verifyNotNull(argument()).getLocalName();
+ }
- @Nonnull
- String getName();
-
- @Nullable
- PositionStatement getPosition();
+ default @Nullable PositionStatement getPosition() {
+ final Optional<PositionStatement> opt = findFirstDeclaredSubstatement(PositionStatement.class);
+ return opt.isPresent() ? opt.get() : null;
+ }
}