Class NullableIndex

java.lang.Object
software.amazon.smithy.model.knowledge.NullableIndex
All Implemented Interfaces:
KnowledgeIndex
Direct Known Subclasses:
BoxIndex

public class NullableIndex extends Object implements KnowledgeIndex
An index that checks if a shape can be set to null.
  • Constructor Details

    • NullableIndex

      public NullableIndex(Model model)
  • Method Details

    • of

      public static NullableIndex of(Model model)
    • isNullable

      public final boolean isNullable(ToShapeId shape)
      Checks if the given shape can be set to null.

      When given a list member or map value member, this method will return true if and only if the container of the member is marked with the SparseTrait. When given a member of a structure, this method will return true if and only if the member is marked with the BoxTrait, the targeted shape is marked with the box trait, or if the targeted shape is inherently boxed. When given a set member, union member, or map key member, this method will always return false. When given any other shape, this method will return true if the shape is inherently boxed, meaning the shape is either marked with the box trait, or the shape is a string, blob, timestamp, bigDecimal, bigInteger, list, set, map, structure, union or document.

      Parameters:
      shape - Shape or shape ID to check.
      Returns:
      Returns true if the shape can be set to null.