public boolean equals(Object obj) { if (obj instanceof BType) { BType other = (BType) obj; boolean namesEqual = this.typeName.equals(other.getName()); // If both package paths are null or both package paths are not null, // then check their names. If not return false if (this.pkgPath == null && other.getPackagePath() == null) { return namesEqual; } else if (this.pkgPath != null && other.getPackagePath() != null) { return this.pkgPath.equals(other.getPackagePath()) && namesEqual; } } return false; }
/** * Get full service name with the package path. * * @param serviceInfoType service info type * @return full qualified service name */ private static String getFullServiceName(BType serviceInfoType) { return serviceInfoType.getPackagePath().equals(PACKAGE_SEPARATOR) ? serviceInfoType.getName() : serviceInfoType.getPackagePath() + PACKAGE_SEPARATOR + serviceInfoType.getName(); }
public static String getFullServiceName(ServiceInfo serviceInfo) { BType serviceInfoType = serviceInfo.getType(); return serviceInfoType.getPackagePath().equals(PACKAGE_SEPARATOR) ? serviceInfoType.getName() : serviceInfoType.getPackagePath() + PACKAGE_SEPARATOR + serviceInfoType.getName(); }
/** * Get the full service name. * * @param serviceInfo service info * @return service name */ public static String getFullServiceName(ServiceInfo serviceInfo) { BType serviceInfoType = serviceInfo.getType(); return serviceInfoType.getPackagePath().equals(PACKAGE_SEPARATOR) ? serviceInfoType.getName() : serviceInfoType.getPackagePath() + PACKAGE_SEPARATOR + serviceInfoType.getName(); }
public static BMap<String, BValue> getHeaderStruct(Resource resource) { if (resource == null || resource.getParamDetails() == null) { throw new RuntimeException("Invalid resource input arguments"); } BMap<String, BValue> headerStruct = null; for (ParamDetail detail : resource.getParamDetails()) { BType paramType = detail.getVarType(); if (paramType != null && PROTOCOL_STRUCT_PACKAGE_GRPC.equals(paramType.getPackagePath()) && "Headers".equals(paramType.getName())) { headerStruct = BLangConnectorSPIUtil.createBStruct(getProgramFile(resource), paramType.getPackagePath(), paramType.getName()); break; } } return headerStruct; }
if (value != null) { if (value instanceof BMap && value.getType().getName().equals(Constants.STRUCT_TIME) && value.getType() .getPackagePath().equals(Constants.STRUCT_TIME_PACKAGE)) { BValue timeVal = ((BMap<String, BValue>) value).get(TIME_FIELD); long time = ((BInteger) timeVal).intValue();
if (value != null) { if (value instanceof BMap && value.getType().getName().equals(Constants.STRUCT_TIME) && value.getType() .getPackagePath().equals(Constants.STRUCT_TIME_PACKAGE)) { BValue timeVal = ((BMap<String, BValue>) value).get(TIME_FIELD); long time = ((BInteger) timeVal).intValue();
if (value != null) { if (value instanceof BMap && value.getType().getName().equals(Constants.STRUCT_TIME) && value.getType() .getPackagePath().equals(Constants.STRUCT_TIME_PACKAGE)) { BValue timeVal = ((BMap<String, BValue>) value).get(TIME_FIELD); long time = ((BInteger) timeVal).intValue();
public SerializableBRefArray(BValueArray bRefValueArray, SerializableState state) { BArrayType arrayType = (BArrayType) bRefValueArray.getType(); if (arrayType != null) { structName = arrayType.getElementType().getName(); pkgPath = arrayType.getElementType().getPackagePath(); } for (int i = 0; i < bRefValueArray.size(); i++) { values.add(state.serialize(bRefValueArray.getRefValue(i))); } }
public SerializableBMap(BMap<K, V> bMap, SerializableState state) { structName = bMap.getType().getName(); pkgPath = bMap.getType().getPackagePath(); bMap.getNativeData().forEach((k, o) -> nativeData.put(k, state.serialize(o))); bMap.getMap().forEach((k, v) -> map.put(k, state.serialize(v))); }
Map<String, BType> bMapFields = new HashMap<>(); if (bType instanceof BRecordType) { bMapValue = BLangConnectorSPIUtil.createBStruct(programFile, bType.getPackagePath(), bType.getName()); for (BField messageField : ((BRecordType) bType).getFields().values()) { bMapFields.put(messageField.fieldName, messageField.fieldType);