TypeMatcher

Helper class that allows you to match value types based on equality.

Description

The TypeMatcher class allows you to match value types based on equality.

Important points

  • This class has symmetric implementation across all languages supported by the Pip.Services toolkit and it is used to support dynamic data processing.

Static methods

matchType

Matches expected type to an actual type. The types can be specified as types, type names or TypeCode.

public static matchType(expectedType: any, actualType: TypeCode, actualValue: any = null): boolean

  • expectedType: any - an expected type to match.
  • actualType: TypeCode - an actual type to match.
  • actualValue: any - an optional value to match its type to the expected one.
  • returns: boolean - true if types are matching and false if they don’t.

matchTypeByName

public static matchTypeByName(expectedType: string, actualType: TypeCode, actualValue: any = null): boolean

  • expectedType: string - an expected type name to match.
  • actualType: TypeCode - an actual type to match defined by type code.
  • actualValue: any - an optional value to match its type to the expected one.
  • returns: boolean - true if types are matching and false if they don’t.

matchValueType

Matches expected type to a type of a value. The expected type can be specified by a type, type name or TypeCode.

public static matchValueType(expectedType: any, actualValue: any): boolean

  • expectedType: any - an expected type to match.
  • actualValue: any - a value to match its type to the expected one.
  • returns: boolean - true if types are matching and false if they don’t.

matchValueTypeByName

Matches expected type to a type of a value.

public static matchValueTypeByName(expectedType: string, actualValue: any): boolean

  • expectedType: any - an expected type name to match.
  • actualValue: any - a value to match its type to the expected one.
  • returns: boolean - true if types are matching and false if they don’t.

See also