Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #344 from HindujaB/fix-getType-API
Browse files Browse the repository at this point in the history
Fix object getType() API usage
  • Loading branch information
aashikam authored May 2, 2023
2 parents 6b1f5ed + c34285e commit b8e97b3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion native/src/main/java/io/ballerina/stdlib/stan/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static byte[] convertDataIntoByteArray(Object data) {

public static MethodType getAttachedFunctionType(BObject serviceObject, String functionName) {
MethodType function = null;
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(serviceObject.getType());
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(serviceObject));
MethodType[] resourceFunctions = objectType.getMethods();
for (MethodType resourceFunction : resourceFunctions) {
if (functionName.equals(resourceFunction.getName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Object attach(Environment environment, BObject streamingListener,
Object serviceName) {
String subject;
Object streamingConnectionUrl = streamingListener.getNativeData(Constants.URL.getValue());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
@SuppressWarnings("unchecked")
BMap<BString, Object> annotation = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Expand All @@ -73,7 +73,7 @@ public static Object attach(Environment environment, BObject streamingListener,
}

private static boolean getAckMode(BObject service) {
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
@SuppressWarnings("unchecked")
BMap<BString, Object> serviceConfig = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void executeResource(String subject, Object[] args, Type returnType) {
CountDownLatch countDownLatch = new CountDownLatch(1);
StrandMetadata metadata = new StrandMetadata(Utils.getModule().getOrg(), Utils.getModule().getName(),
Utils.getModule().getVersion(), Constants.ON_MESSAGE_RESOURCE);
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
if (ObserveUtils.isTracingEnabled()) {
Map<String, Object> properties = new HashMap<>();
NatsObserverContext observerContext = new NatsObserverContext(NatsObservabilityConstants.CONTEXT_CONSUMER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void streamingSubscribe(BObject streamingListener) {
private static Subscription createSubscription(BObject service, StreamingListener messageHandler,
io.nats.streaming.StreamingConnection streamingConnection,
NatsMetricsReporter natsMetricsReporter) {
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType serviceType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
BMap<BString, Object> annotation = (BMap<BString, Object>) serviceType
.getAnnotation(StringUtils.fromString(Utils.getModule().getOrg() + ORG_NAME_SEPARATOR +
Utils.getModule().getName() + VERSION_SEPARATOR +
Expand Down

0 comments on commit b8e97b3

Please sign in to comment.