use of io.spine.type.TypeUrl in project core-java by SpineEventEngine.
the class Queries method typeOf.
/**
* Extract the type of {@link Target} for the given {@link Query}.
*
* <p>Throws an {@link IllegalStateException} 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 String type = target.getType();
final TypeUrl typeUrl = TypeUrl.parse(type);
checkState(getAllUrls().contains(typeUrl), "Unknown type URL: `%s`.", type);
return typeUrl;
}
Aggregations