1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package dev.metaschema.core.model;
7
8 import edu.umd.cs.findbugs.annotations.NonNull;
9
10 /**
11 * Represents a field instance that appears directly within an assembly
12 * definition.
13 * <p>
14 * An absolute field instance is not part of a choice or other grouping
15 * construct, and has its own distinct cardinality and XML wrapping settings.
16 */
17 public interface IFieldInstanceAbsolute extends IFieldInstance, INamedModelInstanceAbsolute {
18
19 @Override
20 default boolean isEffectiveValueWrappedInXml() {
21 return isInXmlWrapped() || !getDefinition().getJavaTypeAdapter().isUnrappedValueAllowedInXml();
22 }
23
24 /**
25 * A visitor callback.
26 *
27 * @param <CONTEXT>
28 * the type of the context parameter
29 * @param <RESULT>
30 * the type of the visitor result
31 * @param visitor
32 * the calling visitor
33 * @param context
34 * a parameter used to pass contextual information between visitors
35 * @return the visitor result
36 */
37 @Override
38 default <CONTEXT, RESULT> RESULT accept(@NonNull IModelElementVisitor<CONTEXT, RESULT> visitor, CONTEXT context) {
39 return visitor.visitFieldInstance(this, context);
40 }
41 }