Comparing the return values of .getClass() and .class

Viewed 154

I'm trying to design some micro services using SpringBoot.

I have a problem when comparing (what seemed to me) same values and always getting an output of false. This is the method that should compare the 2 values:

@Override
public boolean accepts(Event event) {
    System.err.println("In the accepts method of FlightResponsePipelineProcessor");
    System.err.println(event.getValue().getClass());
    System.err.println(FlightResponse.class);
    System.err.println(event.getValue().getClass().equals(FlightResponse.class));
    return event.getValue().getClass().equals(FlightResponse.class);
}

When the method is executed, I get this in the console:

In the accepts method of FlightResponsePipelineProcessor
class avro.schemas.v1.FlightResponse
class avro.schemas.v1.FlightResponse
false

Does anyone know why? I assume that I misunderstood what .getClass() and .class return, but it seemed the same in the console.

0 Answers
Related