mil.dod.th.ose.shared/src/mil/dod/th/ose/shared/protoconverter/JaxbConverter.java
private static Object checkValueForMessage(final FieldDescriptor field, final Object value, 
            final String protoFieldName, final Class<? extends Message> messageType) throws ObjectConverterException
    {
        if (field.getType() == Type.MESSAGE)
        {
            final Class<? extends Message> refClass = findClass(protoFieldName, messageType);
            if (refClass == Multitype.class)
            {
                return handleMultitype(value);
            }
            return buildProto(value, refClass);

        }
        else if (field.getType() == Type.ENUM)
        {
            final ProtocolMessageEnum enumObject = EnumConverter.convertJavaEnumToProto((Enum<?>)value);
            return enumObject.getValueDescriptor();
        }
        else
        {
            if (field.getType() == Type.BYTES)
            {
                return ByteString.copyFrom((byte[])value);
            }
            else
            {
                return value;
            }
        }
    }
/**
     * This method is responsible for determining the value to be set for the specified protocol field. If the value
     * is of type reference, then the {@link #buildProto(Object, Class)} method is called to convert the reference 
     * class to a {@link Message}. The created message for the reference field is then returned and set for the value 
     * of the specified protocol field.
     * 
     * @param field
     *          The protocol field that represents a field in the {@link Message}.
     * @param value
     *          The value that belongs to the corresponding protocol field.
     * @param protoFieldName
     *          The string representation of the protocol field.
     * @param messageType
     *          The class of the {@link Message} being created.
     * @return
     *          The value of the specified protocol field.
     * @throws ObjectConverterException
     *          When the field value is unable to be set for the specified field. 
     */
This method is responsible for determining the value to be set for the specified protocol field. If the value
is of type reference, then the  #buildProto(Object, Class) method is called to convert the reference
class to a  Message. The created message for the reference field is then returned and set for the value
of the specified protocol field.

@param field
The protocol field that represents a field in the  Message.
@param value
The value that belongs to the corresponding protocol field.
@param protoFieldName
The string representation of the protocol field.
@param messageType
The class of the  Message being created.
@return
The value of the specified protocol field.
@throws ObjectConverterException
When the field value is unable to be set for the specified field.
This method is responsible for determining the value to be set for the specified protocol field . If the value is of type reference then the #buildProto ( Object Class ) method is called to convert the reference class to a Message . The created message for the reference field is then returned and set for the value of the specified protocol field . @param field The protocol field that represents a field in the Message . @param value The value that belongs to the corresponding protocol field . @param protoFieldName The string representation of the protocol field . @param messageType The class of the Message being created . @return The value of the specified protocol field . @throws ObjectConverterException When the field value is unable to be set for the specified field .
private static Object checkValueForMessage(final FieldDescriptor field, final Object value, 
            final String protoFieldName, final Class<? extends Message> messageType) throws ObjectConverterException
    {
        if (field.getType() == Type.MESSAGE)
        {
            final Class<? extends Message> refClass = findClass(protoFieldName, messageType);
            if (refClass == Multitype.class)
            {
                return handleMultitype(value);
            }
            return buildProto(value, refClass);
        }
        else if (field.getType() == Type.ENUM)
        {
            final ProtocolMessageEnum enumObject = EnumConverter.convertJavaEnumToProto((Enum<?>)value);
            return enumObject.getValueDescriptor();
        }
        else
        {
            if (field.getType() == Type.BYTES)
            {
                return ByteString.copyFrom((byte[])value);
            }
            else
            {
                return value;
            }
        }
    }
private static Object checkValueForMessage ( final FieldDescriptor field , final Object value , final String protoFieldName , final Class < ? extends Message > messageType ) throws ObjectConverterException { if ( field . getType ( ) == Type . MESSAGE ) { final Class < ? extends Message > refClass = findClass ( protoFieldName , messageType ) ; if ( refClass == Multitype . class ) { return handleMultitype ( value ) ; } return buildProto ( value , refClass ) ; } else if ( field . getType ( ) == Type . ENUM ) { final ProtocolMessageEnum enumObject = EnumConverter . convertJavaEnumToProto ( ( Enum < ? > ) value ) ; return enumObject . getValueDescriptor ( ) ; } else { if ( field . getType ( ) == Type . BYTES ) { return ByteString . copyFrom ( ( byte [ ] ) value ) ; } else { return value ; } } }
This method is responsible for determining the value to be set for the specified protocol field.
This method is responsible for determining the value to be set for the specified protocol field .