Uploaded image for project: 'CRISP'
  1. CRISP
  2. CRISP-80

Refactor duplicated code blocks

    XMLWordPrintable

    Details

    • Similar issues:

      Description

      thanks to Intellij inspections), those 2 methods are pretty much duplicated (same logic):

      org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver#resolve
      org.onehippo.cms7.crisp.core.resource.jdom.SimpleJdomRestTemplateResourceResolver#findResources

      I also run inspection for other parts and one thing that is repeating and could be extracted to util method is following block:

            if (type == Integer.class) {
                          return (T) Integer.valueOf((String) value);
                      } else if (type == Long.class) {
                          return (T) Long.valueOf((String) value);
                      } else if (type == Double.class) {
                          return (T) Double.valueOf((String) value);
                      } else if (type == Boolean.class) {
                          return (T) Boolean.valueOf((String) value);
                      } else if (type == BigDecimal.class) {
                          return (T) new BigDecimal((String) value);
                      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mmilicevic Marijan Milicevic
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: