Search in sources :

Example 1 with ClassName

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);
}
Also used : ClassName(io.spine.type.ClassName) TypeUrl(io.spine.type.TypeUrl) Test(org.junit.Test)

Example 2 with 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);
}
Also used : ClassName(io.spine.type.ClassName) TypeUrl(io.spine.type.TypeUrl) Test(org.junit.Test)

Example 3 with ClassName

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;
}
Also used : ClassName(io.spine.type.ClassName) CheckReturnValue(javax.annotation.CheckReturnValue)

Example 4 with ClassName

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);
}
Also used : ClassName(io.spine.type.ClassName) TypeUrl(io.spine.type.TypeUrl)

Aggregations

ClassName (io.spine.type.ClassName)4 TypeUrl (io.spine.type.TypeUrl)3 Test (org.junit.Test)2 CheckReturnValue (javax.annotation.CheckReturnValue)1