
com.aerospike.dsl.model.cdt.list.ListIndex Maven / Gradle / Ivy
The newest version!
package com.aerospike.dsl.model.cdt.list;
import com.aerospike.client.cdt.CTX;
import com.aerospike.client.exp.Exp;
import com.aerospike.client.exp.ListExp;
import com.aerospike.dsl.ConditionParser;
import com.aerospike.dsl.model.BasePath;
public class ListIndex extends ListPart {
private final int index;
public ListIndex(int index) {
super(ListPartType.INDEX);
this.index = index;
}
public static ListIndex from(ConditionParser.ListIndexContext ctx) {
return new ListIndex(Integer.parseInt(ctx.INT().getText()));
}
@Override
public Exp constructExp(BasePath basePath, Exp.Type valueType, int cdtReturnType, CTX[] context) {
return ListExp.getByIndex(cdtReturnType, valueType, Exp.val(index),
Exp.bin(basePath.getBinPart().getBinName(), basePath.getBinType()), context);
}
@Override
public CTX getContext() {
return CTX.listIndex(index);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy