Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Return proper object from comparison

I have the following code:

public class FeeContext {
}
public class DefaultContext {
}

Code:

private FeeContext generateDefaultOrTierContext(FeeDto fee) {
    FeeContext ctx = createDefault(fee);
    return ctx == null ? createTierContext(fee) : ctx;
  }

  private DefaultContext createDefault(FeeDto fee) {
    DefaultContext defaultContext = new DefaultContext();
    ....
    return defaultContext;
  }

  private TierContext createTierContext(FeeDto fee) {
    TierContext tierContext = new TierContext();
    .....
    return tierContext;
  }

I get error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Required type: FeeContext
Provided: TierContext

I suppose that TierContext should extend FeeContext but I;m not sure is this correct. I tried this but again I get the same issue. Do you know how this can be solved? The code block should be correct.

>Solution :

TierContext and DefaultContext have to extend FeeContext:

public class TierContext extends FeeContext {}
public class DefaultContext extends FeeContext {}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading