Class TypeCompatibility

java.lang.Object
com.soulfiremc.server.script.TypeCompatibility

public final class TypeCompatibility extends Object
Single source of truth for port type compatibility rules. Used by both the server-side graph validator and the client-side connection check (via the PortTypeMetadata proto sent in GetNodeTypesResponse).
  • Method Details

    • isCompatible

      public static boolean isCompatible(PortType source, PortType target)
      Checks whether a source port type is compatible with a target port type. Same type always matches. ANY on either side matches. STRING target accepts all. NUMBER<->BOOLEAN coercion is allowed.
    • isDescriptorCompatible

      public static boolean isDescriptorCompatible(TypeDescriptor source, TypeDescriptor target)
      Checks whether a source TypeDescriptor is compatible with a target TypeDescriptor. Handles generics, type variables, and parameterized types. This is a non-mutating check (does not bind type variables).
    • getCompatibleFrom

      public static Set<PortType> getCompatibleFrom(PortType targetType)
      Returns the compatible_from set for a given target type. Used to populate the PortTypeMetadata proto.