use of io.spine.type.TypeName in project core-java by SpineEventEngine.
the class SubscriptionService method selectBoundedContext.
private BoundedContext selectBoundedContext(Subscription subscription) {
final TypeName typeName = TypeName.of(subscription.getTopic().getTarget().getType());
final TypeUrl type = typeName.toUrl();
final BoundedContext result = typeToContextMap.get(type);
return result;
}
use of io.spine.type.TypeName in project core-java by SpineEventEngine.
the class AggregateStateIdStringifier method idTypeFromString.
private static Class idTypeFromString(String idTypeString) {
final Class result;
if (idTypeString.contains(TYPE_NAME_DIVIDER)) {
final TypeName typeName = TypeName.of(idTypeString);
result = typeName.getJavaClass();
} else {
try {
result = Class.forName(JAVA_LANG_PACKAGE_NAME + idTypeString);
} catch (ClassNotFoundException e) {
throw Exceptions.illegalStateWithCauseOf(e);
}
}
return result;
}
use of io.spine.type.TypeName in project core-java by SpineEventEngine.
the class SubscriptionService method selectBoundedContext.
private BoundedContext selectBoundedContext(Target target) {
final TypeName typeName = TypeName.of(target.getType());
final TypeUrl type = typeName.toUrl();
final BoundedContext result = typeToContextMap.get(type);
return result;
}
use of io.spine.type.TypeName in project core-java by SpineEventEngine.
the class InvalidCommandException method onInapplicableTenantId.
public static InvalidCommandException onInapplicableTenantId(Command command) {
final CommandEnvelope cmd = CommandEnvelope.of(command);
final TypeName typeName = TypeName.of(cmd.getMessage());
final String errMsg = format("The command (class: %s, type: %s, id: %s) was posted to single-tenant " + "CommandBus, but has tenant_id: %s attribute set in the command context.", cmd.getMessageClass(), typeName, cmd.getCommandId(), cmd.getTenantId());
final Error error = inapplicableTenantError(cmd.getMessage(), errMsg);
return new InvalidCommandException(errMsg, command, error);
}
use of io.spine.type.TypeName in project core-java by SpineEventEngine.
the class Queries method typeOf.
/**
* Extract the type of {@link Target} for the given {@link Query}.
*
* <p>Returns null if the {@code Target} type is unknown to the application.
*
* @param query the query of interest.
* @return the URL of the type of the query {@linkplain Query#getTarget() target}
*/
public static TypeUrl typeOf(Query query) {
checkNotNull(query);
final Target target = query.getTarget();
final TypeName typeName = TypeName.of(target.getType());
final TypeUrl type = typeName.toUrl();
return type;
}
Aggregations