Class TypeMatcher

java.lang.Object
org.pipservices3.commons.reflect.TypeMatcher

public class TypeMatcher extends Object
Helper class matches value types for equality.

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

See Also:
  • Constructor Details

    • TypeMatcher

      public TypeMatcher()
  • Method Details

    • matchValueType

      public static boolean matchValueType(Object expectedType, Object actualValue)
      Matches expected type to a type of a value. The expected type can be specified by a type, type name or TypeCode.
      Parameters:
      expectedType - an expected type to match.
      actualValue - a value to match its type to the expected one.
      Returns:
      true if types are matching and false if they don't.
      See Also:
    • matchType

      public static boolean matchType(Object expectedType, TypeCode actualType, Object actualValue)
      Matches expected type to an actual type. The types can be specified as types, type names or TypeCode.
      Parameters:
      expectedType - an expected type to match.
      actualType - an actual type to match.
      actualValue - an optional value to match its type to the expected one.
      Returns:
      true if types are matching and false if they don't.
      See Also:
    • matchType

      public static boolean matchType(Object expectedType, TypeCode actualType)
      Matches expected type to an actual type. The types can be specified as types, type names or TypeCode.
      Parameters:
      expectedType - an expected type to match.
      actualType - an actual type to match.
      Returns:
      true if types are matching and false if they don't.
      See Also:
    • matchValueTypeByName

      public static boolean matchValueTypeByName(String expectedType, Object actualValue)
      Matches expected type to a type of a value.
      Parameters:
      expectedType - an expected type name to match.
      actualValue - a value to match its type to the expected one.
      Returns:
      true if types are matching and false if they don't.
    • matchTypeByName

      public static boolean matchTypeByName(String expectedType, TypeCode actualType, Object actualValue)
      Matches expected type to an actual type.
      Parameters:
      expectedType - an expected type name to match.
      actualType - an actual type to match defined by type code.
      actualValue - an optional value to match its type to the expected one.
      Returns:
      true if types are matching and false if they don't.
    • matchTypeByName

      public static boolean matchTypeByName(String expectedType, TypeCode actualType)
      Matches expected type to an actual type.
      Parameters:
      expectedType - an expected type name to match.
      actualType - an actual type to match defined by type code.
      Returns:
      true if types are matching and false if they don't.