use of org.ballerinalang.util.codegen.PackageVarInfo in project ballerina by ballerina-lang.
the class ConnectorSPIModelHelper method getAnnotationVariable.
public static BMap getAnnotationVariable(String pkgPath, ProgramFile programFile) {
PackageInfo packageInfo = programFile.getPackageInfo(pkgPath);
PackageVarInfo annotationData = packageInfo.getPackageVarInfo(ANNOTATION_DATA);
final LockableStructureType globalMemoryBlock = programFile.getGlobalMemoryBlock();
return (BMap) globalMemoryBlock.getRefField(annotationData.getGlobalMemIndex());
}
use of org.ballerinalang.util.codegen.PackageVarInfo in project ballerina by ballerina-lang.
the class BLangConnectorSPIUtil method getPackageEndpoint.
public static BStruct getPackageEndpoint(ProgramFile programFile, String pkgName, String endpointName) {
final PackageInfo packageInfo = programFile.getPackageInfo(pkgName);
if (packageInfo == null) {
throw new BallerinaConnectorException("Incorrect package name");
}
final PackageVarInfo packageVarInfo = packageInfo.getPackageVarInfo(endpointName);
if (packageVarInfo == null) {
throw new BallerinaConnectorException("Can't locate " + endpointName + " endpoint variable");
}
return (BStruct) programFile.getGlobalMemoryBlock().getRefField(packageVarInfo.getGlobalMemIndex());
}
Aggregations