1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package Torello.Browser;

import Torello.Java.ReadOnly.ReadOnlyList;
import Torello.Java.ReadOnly.ReadOnlyMap;

import javax.json.JsonObject;
import javax.json.stream.JsonGenerator;
import java.util.stream.IntStream;

/**
 * Defines the singleton helper contract that supplies metadata, validation, and JSON conversion
 * logic for a nested CDP type, event, or command-return class.
 *
 * <EMBED CLASS='external-html' DATA-FILE-ID=NestedHelper.top>
 */
@Torello.JavaDoc.Annotations.JDHeaderBackgroundImg(EmbedTagFileID="INTERNAL_USE_JDHBI")
public interface NestedHelper<DOMAIN_NESTED extends BaseType<DOMAIN_NESTED>>
{
    /**
     * Returns the descriptor singleton that describes the field layout and CDP metadata of the
     * nested class.
     *
     * <EMBED CLASS='external-html' DATA-FILE-ID=NestedHelper.descriptor>
     */
    public NestedDescriptor<DOMAIN_NESTED> descriptor();

    /**
     * Builds the read-only {@code isPresent} list for a concrete instance by recording which fields
     * are currently considered present.
     *
     * <EMBED CLASS='external-html' DATA-FILE-ID=NestedHelper.generateIsPresentList>
     */
    public ReadOnlyList<Boolean> generateIsPresentList(DOMAIN_NESTED THIS);

    /**
     * A method that must be implemented by a singleton helper which performs the commonly seen,
     * standard Java {@code 'equals'} method.
     */
    public boolean equals(DOMAIN_NESTED THIS, Object other);

    /**
     * A method that must be implemented by a singleton helper which performs the commonly seen,
     * standard Java {@code 'hashCode'} method.
     */
    public int hashCode(DOMAIN_NESTED THIS);

    /**
     * Writes a concrete nested instance into the supplied JSON generator, optionally as a named
     * property of a larger JSON object.
     *
     * <EMBED CLASS='external-html' DATA-FILE-ID=NestedHelper.toJSON>
     */
    public void toJSON(DOMAIN_NESTED THIS, String name, JsonGenerator jGen);

    /**
     * Parses a {@link JsonObject} and creates the corresponding concrete type, event, or
     * command-return instance.
     */
    public DOMAIN_NESTED fromJSON(JsonObject jo);

    /**
     * Returns the indices of any string fields whose values do not match their allowed enumerated
     * constants.
     *
     * <EMBED CLASS='external-html' DATA-FILE-ID=NestedHelper.enumStrValidate>
     *
     * @see BaseType#enumStrValidate()
     * @see BaseType#enumStrValidateThrow()
     */
    public IntStream enumStrValidate(DOMAIN_NESTED THIS);

    /**
     * Retrieves a {@link ReadOnlyMap} mapping field names to a {@link ReadOnlyList} of valid
     * {@code String} values for each field in the map.
     * 
     * <EMBED CLASS='external-html' DATA-FILE-ID=BaseType.allEnumStrROLs>
     *
     * @see BaseType#allEnumStrROLs()
     */
    public ReadOnlyMap<String, ReadOnlyList<String>> allEnumStrROLs();
}