@Override
        public Node serialize(Object value, Set<Object> serializedObjects, NodeMapper mapper) {
            if (serializedObjects.contains(value)) {
                return Node.nullNode();
            }

            // Add the current value to the set.
            serializedObjects.add(value);
            Map<StringNode, Node> mappings = new TreeMap<>(Comparator.comparing(StringNode::getValue));
            ClassInfo info = ClassInfo.fromClass(value.getClass());

            for (Map.Entry<String, Method> entry : info.getters.entrySet()) {
                try {
                    Object getterResult = entry.getValue().invoke(value);
                    Node result = mapper.serialize(getterResult, serializedObjects);
                    if (canSerialize(mapper, result)) {
                        mappings.put(Node.from(entry.getKey()), result);
                    }
                } catch (ReflectiveOperationException e) {
                    // There's almost always a previous exception, so grab it's more useful message.
                    // If this isn't done, I observed that the message of ReflectiveOperationException is null.
                    String causeMessage = e.getCause() != null ? e.getCause().getMessage() : e.getMessage();
                    String message = String.format(
                            "Error serializing `%s` field of %s using %s(): %s",
                            entry.getKey(),
                            value.getClass().getName(),
                            entry.getValue().getName(),
                            causeMessage);
                    throw new NodeSerializationException(message, e);
                }
            }

            // Remove the current value from the set to ensure that it can be serialized
            // multiple times (like in a List<T>).
            serializedObjects.remove(value);

            // Pass on the source location if it is present.
            SourceLocation sourceLocation = SourceLocation.NONE;
            if (value instanceof FromSourceLocation) {
                sourceLocation = ((FromSourceLocation) value).getSourceLocation();
            }

            return new ObjectNode(mappings, sourceLocation);
        }
Contains the getters of a class that are eligible to convert to a Node.

<p>Getters are public methods that take zero arguments and start with
"get" or "is". Getters that are associated with properties marked as
{@code transient} are not serialized.
smithy-model/src/main/java/software/amazon/smithy/model/node/DefaultNodeSerializers.java