Annotation Type OneofField


  • @Target(FIELD)
    @Retention(SOURCE)
    public @interface OneofField
    Maps a field in a protobuf oneof group to corresponding field/class in the domain objects. This annotation can be place above a class or a class member. The mapping by default is done using the protoField() name in the domainClass(). There are several ways to change the default behavior when this annotation is placed above a field: 1. Standard mapping annotations 2. Using domainField() and optionally converter() properties. This is handy, for example, in cases where the same domain class is used for several fields. 3. Use @ProtoConverter on top of the domain class to convert the proto field to the whole domain class 4. Use converter() property without domainField() to convert the proto field to the whole domain class Used with conjunction of OneofBase
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.Class<?> domainClass  
      java.lang.String protoField  
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.Class<? extends TypeConverter> converter  
      java.lang.String domainField  
    • Element Detail

      • protoField

        java.lang.String protoField
        Returns:
        the name of the protobuf field
      • domainClass

        java.lang.Class<?> domainClass
        Returns:
        The domain class of this field
      • domainField

        java.lang.String domainField
        Returns:
        The name of the domain field (Optional)
        Default:
        ""
      • converter

        java.lang.Class<? extends TypeConverter> converter
        Returns:
        converter if needed. (Optional)
        Default:
        org.silbertb.proto.domainconverter.custom.NullConverter.class