2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableSet;
12 import java.lang.invoke.MethodHandles;
13 import java.lang.invoke.VarHandle;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.MustConstraintAware;
16 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
17 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
21 public abstract class AbstractEffectiveMustConstraintAwareDataSchemaNode<D extends DeclaredStatement<QName>>
22 extends AbstractEffectiveDataSchemaNode<D> implements MustConstraintAware {
23 private static final VarHandle MUST_CONSTRAINTS;
27 MUST_CONSTRAINTS = MethodHandles.lookup().findVarHandle(
28 AbstractEffectiveMustConstraintAwareDataSchemaNode.class, "mustConstraints", ImmutableSet.class);
29 } catch (NoSuchFieldException | IllegalAccessException e) {
30 throw new ExceptionInInitializerError(e);
34 @SuppressWarnings("unused")
35 private volatile ImmutableSet<MustDefinition> mustConstraints;
37 protected AbstractEffectiveMustConstraintAwareDataSchemaNode(final StmtContext<QName, D, ?> ctx) {
42 public final ImmutableSet<MustDefinition> getMustConstraints() {
43 return derivedSet(MUST_CONSTRAINTS, MustDefinition.class);