src/main/java/ca/jeb/protobuf/ProtobufSerializer.java
private static final Object getPojoFieldValue(Object pojo, ProtobufAttribute protobufAttribute, Field field)
          throws ProtobufAnnotationException
  {
    final String getter = protobufAttribute.pojoGetter();

    Object value = null;
    if (!getter.isEmpty())
    {
      try
      {
        return JReflectionUtils.runMethod(pojo, getter);
      }
      catch (Exception e)
      {
        throw new ProtobufAnnotationException("Could not get a value for field " + field.getName() + " using configured getter of "
                + getter, e);
      }
    }

    try
    {
      value = JReflectionUtils.runGetter(pojo, field);
    }
    catch (Exception ee)
    {
      throw new ProtobufAnnotationException("Could not execute getter " + getter + " on class " + pojo.getClass().getCanonicalName() + ": "
              + ee, ee);
    }

    if (value == null && protobufAttribute.required())
    {
      throw new ProtobufAnnotationException("Required field " + field.getName() + " on class " + pojo.getClass().getCanonicalName()
              + " is null");
    }

    return value;
  }
private static final Object getPojoFieldValue(Object pojo, ProtobufAttribute protobufAttribute, Field field)
          throws ProtobufAnnotationException
  {
    final String getter = protobufAttribute.pojoGetter();

    Object value = null;
    if (!getter.isEmpty())
    {
      try
      {
        return JReflectionUtils.runMethod(pojo, getter);
      }
      catch (Exception e)
      {
        throw new ProtobufAnnotationException("Could not get a value for field " + field.getName() + " using configured getter of "
                + getter, e);
      }
    }

    try
    {
      value = JReflectionUtils.runGetter(pojo, field);
    }
    catch (Exception ee)
    {
      throw new ProtobufAnnotationException("Could not execute getter " + getter + " on class " + pojo.getClass().getCanonicalName() + ": "
              + ee, ee);
    }

    if (value == null && protobufAttribute.required())
    {
      throw new ProtobufAnnotationException("Required field " + field.getName() + " on class " + pojo.getClass().getCanonicalName()
              + " is null");
    }

    return value;
  }
private static final Object getPojoFieldValue ( Object pojo , ProtobufAttribute protobufAttribute , Field field ) throws ProtobufAnnotationException { final String getter = protobufAttribute . pojoGetter ( ) ; Object value = null ; if ( ! getter . isEmpty ( ) ) { try { return JReflectionUtils . runMethod ( pojo , getter ) ; } catch ( Exception e ) { throw new ProtobufAnnotationException ( "Could not get a value for field " + field . getName ( ) + " using configured getter of " + getter , e ) ; } } try { value = JReflectionUtils . runGetter ( pojo , field ) ; } catch ( Exception ee ) { throw new ProtobufAnnotationException ( "Could not execute getter " + getter + " on class " + pojo . getClass ( ) . getCanonicalName ( ) + ": " + ee , ee ) ; } if ( value == null && protobufAttribute . required ( ) ) { throw new ProtobufAnnotationException ( "Required field " + field . getName ( ) + " on class " + pojo . getClass ( ) . getCanonicalName ( ) + " is null" ) ; } return value ; }
Returns the field value from the supplied <code>pojo</code> object. If a <code>pojoGetter</code has been set in the
{@link ProtobufAttribute}, then use that, otherwise, try getting the field value directly.

@param pojo - POJO Object
@param protobufAttribute
@param field
@return Object - the resulting object after calling the POJO's getter
@throws ProtobufAnnotationException
Returns the field value from the supplied <code > pojo< / code > object . If a <code > pojoGetter< / code has been set in the { @link ProtobufAttribute } then use that otherwise try getting the field value directly .