class QueryIndexField extends VisorDataTransferObject {
    /** */
    private static final long serialVersionUID = 0L;

    /** Index field name. */
    private String name;

    /** Index field sort order. */
    private boolean sort;

    /**
     * Create data transfer object for given cache type metadata.
     */
    public QueryIndexField() {
        // No-op.
    }

    /**
     * Create data transfer object for index field.
     *
     * @param name Index field name.
     * @param sort Index field sort order.
     */
    public QueryIndexField(String name, boolean sort) {
        this.name = name;
        this.sort = sort;
    }

    /**
     * @param idx Query entity index.
     * @return Data transfer object for query entity index fields.
     */
    public static List<QueryIndexField> list(QueryIndex idx) {<FILL_FUNCTION_BODY>}

    /**
     * @return Index field name.
     */
    public String getName() {
        return name;
    }

    /**
     * @return Index field sort order.
     */
    public boolean getSortOrder() {
        return sort;
    }

    /** {@inheritDoc} */
    @Override protected void writeExternalData(ObjectOutput out) throws IOException {
        U.writeString(out, name);
        out.writeBoolean(sort);
    }

    /** {@inheritDoc} */
    @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
        name = U.readString(in);
        sort = in.readBoolean();
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(QueryIndexField.class, this);
    }
}

        List<QueryIndexField> res = new ArrayList<>();

        for (Map.Entry<String, Boolean> field: idx.getFields().entrySet())
            res.add(new QueryIndexField(field.getKey(), !field.getValue()));

        return res;
    
<methods>public non-sealed void <init>() ,public byte getProtocolVersion() ,public void readExternal(java.io.ObjectInput) throws java.io.IOException, java.lang.ClassNotFoundException,public void writeExternal(java.io.ObjectOutput) throws java.io.IOException<variables>private static final int MAGIC,protected static final byte V1,protected static final byte V2,protected static final byte V3,protected static final byte V4,protected static final byte V5,private static final long serialVersionUID