src/main/java/ca/jeb/protobuf/internal/ProtobufSerializerUtils.java
public static final String getProtobufSetter(ProtobufAttribute protobufAttribute, Field field, Object fieldValue)
  {
    final String fieldName = field.getName();
    final String upperClassName = field.getDeclaringClass().getCanonicalName();
    // Look at the cache first
    Map<String, String> map = CLASS_TO_FIELD_SETTERS_MAP_CACHE.get(upperClassName);
    if (map != null)
    {
      if (!map.isEmpty() && map.containsKey(fieldName))
      {
        return map.get(fieldName);
      }
    }
    else
    {
      map = new ConcurrentHashMap<>();
    }

    String setter = "set" + JStringUtils.upperCaseFirst(fieldName);

    if (fieldValue instanceof Collection)
    {
      setter = "addAll" + JStringUtils.upperCaseFirst(fieldName);
    }

    // Finally override setter with a value that is configured in ProtobufAttribute annotation
    final String configedSetter = protobufAttribute.protobufSetter();
    if (!configedSetter.equals(JStringUtils.EMPTY))
    {
      setter = configedSetter;
    }

    map.put(fieldName, setter);
    CLASS_TO_FIELD_SETTERS_MAP_CACHE.put(upperClassName, map);

    return setter;
  }
public static final String getProtobufSetter(ProtobufAttribute protobufAttribute, Field field, Object fieldValue)
  {
    final String fieldName = field.getName();
    final String upperClassName = field.getDeclaringClass().getCanonicalName();
    // Look at the cache first
    Map<String, String> map = CLASS_TO_FIELD_SETTERS_MAP_CACHE.get(upperClassName);
    if (map != null)
    {
      if (!map.isEmpty() && map.containsKey(fieldName))
      {
        return map.get(fieldName);
      }
    }
    else
    {
      map = new ConcurrentHashMap<>();
    }

    String setter = "set" + JStringUtils.upperCaseFirst(fieldName);

    if (fieldValue instanceof Collection)
    {
      setter = "addAll" + JStringUtils.upperCaseFirst(fieldName);
    }

    // Finally override setter with a value that is configured in ProtobufAttribute annotation
    final String configedSetter = protobufAttribute.protobufSetter();
    if (!configedSetter.equals(JStringUtils.EMPTY))
    {
      setter = configedSetter;
    }

    map.put(fieldName, setter);
    CLASS_TO_FIELD_SETTERS_MAP_CACHE.put(upperClassName, map);

    return setter;
  }
public static final String getProtobufSetter ( ProtobufAttribute protobufAttribute , Field field , Object fieldValue ) { final String fieldName = field . getName ( ) ; final String upperClassName = field . getDeclaringClass ( ) . getCanonicalName ( ) ; // Look at the cache first Map < String , String > map = CLASS_TO_FIELD_SETTERS_MAP_CACHE . get ( upperClassName ) ; if ( map != null ) { if ( ! map . isEmpty ( ) && map . containsKey ( fieldName ) ) { return map . get ( fieldName ) ; } } else { map = new ConcurrentHashMap <> ( ) ; } String setter = "set" + JStringUtils . upperCaseFirst ( fieldName ) ; if ( fieldValue instanceof Collection ) { setter = "addAll" + JStringUtils . upperCaseFirst ( fieldName ) ; } // Finally override setter with a value that is configured in ProtobufAttribute annotation final String configedSetter = protobufAttribute . protobufSetter ( ) ; if ( ! configedSetter . equals ( JStringUtils . EMPTY ) ) { setter = configedSetter ; } map . put ( fieldName , setter ) ; CLASS_TO_FIELD_SETTERS_MAP_CACHE . put ( upperClassName , map ) ; return setter ; }
Return the setter for the Protobuf builder. <br>
1. Defaults to just "set" + upper case the first character of the fieldName.
2. If it's a collection, use the "addAll" type method Protobuf has
3. Otherwise, use the override value from the user's ProtobufAttribute annotation <br>

@param protobufAttribute - {@link ProtobufAttribute}
@param field - String
@param fieldValue - POJO's filed Object
@return String - the setter to be used on Protobuf builder
Return the setter for the Protobuf builder . <br > 1 . Defaults to just set + upper case the first character of the fieldName . 2 . If it s a collection use the addAll type method Protobuf has 3 . Otherwise use the override value from the user s ProtobufAttribute annotation <br >