Details

    • Sub-task
    • Status: Resolved
    • Minor
    • Resolution: Invalid
    • 1.99.5
    • 2.0.0
    • None
    • None

    Description

      The MatcherFactory will create a suitable matcher according to toSchema and fromSchema conditions.

      If NameMatcher is chosen, it means FROM and TO schema should not be empty, so the following code is not necessary. Thanks jerrychenhf for pointing it out.

        public Object[] getMatchingData(Object[] fields) {
          if (getToSchema().isEmpty()) {
            // No destination schema found. No need to convert anything.
            return fields;
          }
      

      If LocationMatcher is chosen, TO schema can be empty. In code there is a rule 0. If TO schema is empty, it will not convert anything.

        public Object[] getMatchingData(Object[] fields) {
          if (getToSchema().isEmpty()) {
            // No destination schema found. No need to convert anything.
            return fields;
          }
      

      I'm thinking we can create a third matcher NullMatcher, which simply return input fields as result. This is a tiny optimization thing.

      Second, it'd be better to have precondition check in constructor of both matcher classes. So that we know better that when the matcher should be used. And related test cases should be updated, if precondition check is added.

      Attachments

        Activity

          People

            stanleyxu2005 Qian Xu
            stanleyxu2005 Qian Xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: