001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.core.model;
007
008import edu.umd.cs.findbugs.annotations.NonNull;
009
010/**
011 * Represents a field instance that appears directly within an assembly
012 * definition.
013 * <p>
014 * An absolute field instance is not part of a choice or other grouping
015 * construct, and has its own distinct cardinality and XML wrapping settings.
016 */
017public interface IFieldInstanceAbsolute extends IFieldInstance, INamedModelInstanceAbsolute {
018
019  @Override
020  default boolean isEffectiveValueWrappedInXml() {
021    return isInXmlWrapped() || !getDefinition().getJavaTypeAdapter().isUnrappedValueAllowedInXml();
022  }
023
024  /**
025   * A visitor callback.
026   *
027   * @param <CONTEXT>
028   *          the type of the context parameter
029   * @param <RESULT>
030   *          the type of the visitor result
031   * @param visitor
032   *          the calling visitor
033   * @param context
034   *          a parameter used to pass contextual information between visitors
035   * @return the visitor result
036   */
037  @Override
038  default <CONTEXT, RESULT> RESULT accept(@NonNull IModelElementVisitor<CONTEXT, RESULT> visitor, CONTEXT context) {
039    return visitor.visitFieldInstance(this, context);
040  }
041}