use of io.spine.type.ClassName in project core-java by SpineEventEngine.
the class KnownTypesShould method return_java_inner_class_name_by_proto_type_url.
@Test
public void return_java_inner_class_name_by_proto_type_url() {
final TypeUrl typeUrl = TypeUrl.from(CommandContext.Schedule.getDescriptor());
final ClassName className = KnownTypes.getClassName(typeUrl);
assertEquals(ClassName.of(CommandContext.Schedule.class), className);
}
use of io.spine.type.ClassName in project core-java by SpineEventEngine.
the class KnownTypesShould method return_proto_type_url_by_java_class_name.
@Test
public void return_proto_type_url_by_java_class_name() {
final ClassName className = ClassName.of(Command.class);
final TypeUrl typeUrl = KnownTypes.getTypeUrl(className);
assertEquals(TypeUrl.from(Command.getDescriptor()), typeUrl);
}
use of io.spine.type.ClassName in project core-java by SpineEventEngine.
the class Repository method getEntityStateType.
/**
* Returns the {@link TypeUrl} for the state objects wrapped by entities
* managed by this repository
*/
@CheckReturnValue
public TypeUrl getEntityStateType() {
if (entityStateType == null) {
final Class<? extends Message> stateClass = getEntityStateClass();
final ClassName stateClassName = ClassName.of(stateClass);
entityStateType = KnownTypes.getTypeUrl(stateClassName);
}
checkNotNull(entityStateType);
return entityStateType;
}
use of io.spine.type.ClassName in project core-java by SpineEventEngine.
the class KnownTypesShould method assertHasClassNameByTypeUrlOf.
private static void assertHasClassNameByTypeUrlOf(Class<? extends Message> msgClass) {
final TypeUrl typeUrl = TypeUrl.of(msgClass);
final ClassName className = KnownTypes.getClassName(typeUrl);
assertEquals(ClassName.of(msgClass), className);
}
Aggregations