Skip to content

Commit

Permalink
Merge pull request #1393 from HindujaB/fix-getType-API
Browse files Browse the repository at this point in the history
Fix object getType() API usage
  • Loading branch information
HindujaB committed Apr 27, 2023
2 parents 74a48fd + 1cf0ffc commit c48ed33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static Object invokeClientMethod(Environment env, BObject client, BStrin
private static Object invokeClientMethod(Environment env, BObject client, String methodName, Object[] paramFeed) {
Future balFuture = env.markAsync();

ObjectType clientType = (ObjectType) TypeUtils.getReferredType(client.getType());
ObjectType clientType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(client));
if (clientType.isIsolated() && clientType.isIsolated(methodName)) {
env.getRuntime()
.invokeMethodAsyncConcurrently(client, methodName, null, null, new QueryExecutorCallback(balFuture),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ public static Object executeSubscriptionResource(Environment env, BObject contex
Future subscriptionFutureResult = env.markAsync();
ExecutionCallback executionCallback = new ExecutionCallback(subscriptionFutureResult);
BString fieldName = fieldObject.getObjectValue(INTERNAL_NODE).getStringValue(NAME_FIELD);
ServiceType serviceType = (ServiceType) service.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
UnionType typeUnion = TypeCreator.createUnionType(PredefinedTypes.TYPE_STREAM, PredefinedTypes.TYPE_ERROR);
for (ResourceMethodType resourceMethod : serviceType.getResourceMethods()) {
if (SUBSCRIBE_ACCESSOR.equals(resourceMethod.getAccessor()) &&
fieldName.getValue().equals(resourceMethod.getResourcePath()[0])) {
ArgumentHandler argumentHandler = new ArgumentHandler(resourceMethod, context, fieldObject);
Object[] args = argumentHandler.getArguments();
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(service.getType());
ObjectType objectType = (ObjectType) TypeUtils.getReferredType(TypeUtils.getType(service));
if (objectType.isIsolated() && objectType.isIsolated(resourceMethod.getName())) {
env.getRuntime()
.invokeMethodAsyncConcurrently(service, resourceMethod.getName(), null,
Expand All @@ -132,7 +132,7 @@ public static Object executeQueryResource(Environment environment, BObject conte
ResourceMethodType resourceMethod, BObject fieldObject) {
Future future = environment.markAsync();
ExecutionCallback executionCallback = new ExecutionCallback(future);
ServiceType serviceType = (ServiceType) service.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
Type returnType = TypeCreator.createUnionType(PredefinedTypes.TYPE_ANY, PredefinedTypes.TYPE_NULL);
if (resourceMethod != null) {
ArgumentHandler argumentHandler = new ArgumentHandler(resourceMethod, context, fieldObject);
Expand All @@ -154,7 +154,7 @@ public static Object executeMutationMethod(Environment environment, BObject cont
BObject fieldObject) {
Future future = environment.markAsync();
ExecutionCallback executionCallback = new ExecutionCallback(future);
ServiceType serviceType = (ServiceType) service.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
Type returnType = TypeCreator.createUnionType(PredefinedTypes.TYPE_ANY, PredefinedTypes.TYPE_NULL);
for (RemoteMethodType remoteMethod : serviceType.getRemoteMethods()) {
String fieldName = fieldObject.getObjectValue(INTERNAL_NODE).getStringValue(NAME_FIELD).getValue();
Expand All @@ -179,7 +179,7 @@ public static Object executeInterceptor(Environment environment, BObject interce
BObject context) {
Future future = environment.markAsync();
ExecutionCallback executionCallback = new ExecutionCallback(future);
ServiceType serviceType = (ServiceType) interceptor.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(interceptor);
RemoteMethodType remoteMethod = getRemoteMethod(serviceType, INTERCEPTOR_EXECUTE);
Type returnType = TypeCreator.createUnionType(PredefinedTypes.TYPE_ANY, PredefinedTypes.TYPE_NULL);
if (remoteMethod != null) {
Expand All @@ -197,7 +197,7 @@ public static Object executeInterceptor(Environment environment, BObject interce
}

public static Object getResourceMethod(BObject service, BArray path) {
ServiceType serviceType = (ServiceType) service.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
List<String> pathList = getPathList(path);
return getResourceMethod(serviceType, pathList, GET_ACCESSOR);
}
Expand Down Expand Up @@ -239,13 +239,13 @@ private static Object[] getInterceptorArguments(BObject context, BObject field)
}

public static BString getInterceptorName(BObject interceptor) {
ServiceType serviceType = (ServiceType) interceptor.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(interceptor);
return StringUtils.fromString(serviceType.getName());
}

public static Object getResourceAnnotation(BObject service, BString operationType, BArray path,
BString methodName) {
ServiceType serviceType = (ServiceType) service.getType();
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
MethodType methodType = null;
if (OPERATION_QUERY.equals(operationType.getValue())) {
methodType = getResourceMethod(serviceType, getPathList(path), GET_ACCESSOR);
Expand Down

0 comments on commit c48ed33

Please sign in to comment.