com.google.gerrit.entities.converter.SafeProtoConverter Maven / Gradle / Ivy
The newest version!
package com.google.gerrit.entities.converter;
import com.google.errorprone.annotations.Immutable;
import com.google.gerrit.common.ConvertibleToProto;
import com.google.protobuf.Message;
/**
* An extension to {@link ProtoConverter} that enforces the Entity class and the Proto class to stay
* in sync. The enforcement is done by {@link SafeProtoConverterTest}.
*
* Requirements:
*
*
* - Implementing classes must be enums with a single value. Please prefer descriptive enum and
* instance names, such as {@code MyTypeConverter::MY_TYPE_CONVERTER}.
*
- The Java Entity class must be annotated with {@link ConvertibleToProto}.
*
*
* All safe converters are tested using {@link SafeProtoConverterTest}. Therefore, unless your
* Entity class has a {@code defaults()} method, or other methods besides simple getters and
* setters, there is no need to explicitly test your safe converter.
*/
@Immutable
public interface SafeProtoConverter
extends ProtoConverter
{
Class
getProtoClass();
Class getEntityClass();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy