0

I'm attempting to access a method inside a nested class that my class extends. Specifically, it's the getSenderSubID() method in quickfix.fix42.Message.Header. enter image description here

public class ExecutionReport extends Message, and the constructor of Message is:

protected Message(int[] fieldOrder) {
        super(fieldOrder);
        header = new Header(this);
        trailer = new Trailer();
        
        getHeader().setField(new BeginString("FIX.4.2"));
            
    }

The nested Header class is:

public static class Header extends quickfix.Message.Header {

        static final long serialVersionUID = 20050617;

        public Header(Message msg) {
            // JNI compatibility
        }

and the method inside there I want to access is:

    public quickfix.field.SenderSubID getSenderSubID() throws FieldNotFound {
        return get(new quickfix.field.SenderSubID());
    }

To me all of this looks like I should be able to use this method, but it's apparent that I cannot. How could this be?

I double checked that all classes were in package quickfix.fix42; and there were no method overrides in ExecutionReport.

1 Answer 1

2

(Not sure what FIX version you're using; I'll say you're using FIX44 for the purposes of this answer. You can adjust accordingly.)

I think getHeader() is returning a quickfix.Message.Header and not a quickfix.fix44.Message.Header. Only the latter has getSenderSubID().

Try casting quickfix.Message.Header to quickfix.fix44.Message.Header.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.