mil.dod.th.ose.shared/src/mil/dod/th/ose/shared/SharedMessageUtils.java
@SuppressWarnings({"rawtypes"}) //NOCHECKSTYLE -> Complexity is 14; Max is 12. Need breakdown of if statements to identify correct object type.
    public static Multitype convertObjectToMultitype(final Object value) 
    {
        final Multitype.Builder builder = Multitype.newBuilder();
        if (value == null)
        {
            builder.setType(Type.NONE);
        }
        else if (value instanceof Integer)
        {
            builder.setType(Type.INT32);
            builder.setInt32Value((Integer)value);
        }
        else if (value instanceof Long)
        {
            builder.setType(Type.INT64);
            builder.setInt64Value((Long)value);
        }
        else if (value instanceof String)
        {
            builder.setType(Type.STRING);
            builder.setStringValue((String)value);
        }
        else if (value instanceof Boolean)
        {
            builder.setType(Type.BOOL);
            builder.setBoolValue((Boolean)value);
        }
        else if (value instanceof Float)
        {
            builder.setType(Type.FLOAT);
            builder.setFloatValue((Float)value);
        }
        else if (value instanceof Double)
        {
            builder.setType(Type.DOUBLE);
            builder.setDoubleValue((Double)value);
        }
        else if (value instanceof Short)
        {
            builder.setType(Type.SHORT);
            builder.setShortValue(((Short)value).intValue());
        }
        else if (value instanceof Character)
        {
            builder.setType(Type.CHARACTER);
            builder.setCharValue(((Character)value).toString());
        }
        else if (value instanceof Byte)
        {
            builder.setType(Type.BYTE);
            builder.setByteValue(((Byte)value).intValue());
        }
        else if (value instanceof ByteString)
        {
            builder.setType(Type.BYTES);
            builder.setByteStringValue((ByteString)value);
            
        }
        else if (value instanceof UUID)
        {
            final UUID uuid = (UUID)value;

            builder.setType(Type.UUID);
            builder.setUuidMostSigBitsValue(uuid.getMostSignificantBits());
            builder.setUuidLeastSigBitsValue(uuid.getLeastSignificantBits());
        }
        else if (value instanceof List)
        {
            builder.setType(Type.MULTITYPE_LIST);
            for (Object entry : (List)value)
            {
                builder.addList(convertObjectToMultitype(entry));
            }
        }
        else
        {
            throw new IllegalArgumentException(
                    String.format("Cannot convert object [%s] to Multitype, invalid type: %s", 
                            value, value.getClass()));
        }
        return builder.build();
    }
/**
     * Convert an object to a {@link Multitype} object that can be used within protocol buffer messages.
     * 
     * @param value
     *      object to convert 
     * @return
     *      object that contains the value of the object plus an enumeration that describes the type of data
     */
Convert an object to a  Multitype object that can be used within protocol buffer messages.

@param value
object to convert
@return
object that contains the value of the object plus an enumeration that describes the type of data
Convert an object to a Multitype object that can be used within protocol buffer messages . @param value object to convert @return object that contains the value of the object plus an enumeration that describes the type of data
@SuppressWarnings({"rawtypes"}) 
    public static Multitype convertObjectToMultitype(final Object value) 
    {
        final Multitype.Builder builder = Multitype.newBuilder();
        if (value == null)
        {
            builder.setType(Type.NONE);
        }
        else if (value instanceof Integer)
        {
            builder.setType(Type.INT32);
            builder.setInt32Value((Integer)value);
        }
        else if (value instanceof Long)
        {
            builder.setType(Type.INT64);
            builder.setInt64Value((Long)value);
        }
        else if (value instanceof String)
        {
            builder.setType(Type.STRING);
            builder.setStringValue((String)value);
        }
        else if (value instanceof Boolean)
        {
            builder.setType(Type.BOOL);
            builder.setBoolValue((Boolean)value);
        }
        else if (value instanceof Float)
        {
            builder.setType(Type.FLOAT);
            builder.setFloatValue((Float)value);
        }
        else if (value instanceof Double)
        {
            builder.setType(Type.DOUBLE);
            builder.setDoubleValue((Double)value);
        }
        else if (value instanceof Short)
        {
            builder.setType(Type.SHORT);
            builder.setShortValue(((Short)value).intValue());
        }
        else if (value instanceof Character)
        {
            builder.setType(Type.CHARACTER);
            builder.setCharValue(((Character)value).toString());
        }
        else if (value instanceof Byte)
        {
            builder.setType(Type.BYTE);
            builder.setByteValue(((Byte)value).intValue());
        }
        else if (value instanceof ByteString)
        {
            builder.setType(Type.BYTES);
            builder.setByteStringValue((ByteString)value);
        }
        else if (value instanceof UUID)
        {
            final UUID uuid = (UUID)value;
            builder.setType(Type.UUID);
            builder.setUuidMostSigBitsValue(uuid.getMostSignificantBits());
            builder.setUuidLeastSigBitsValue(uuid.getLeastSignificantBits());
        }
        else if (value instanceof List)
        {
            builder.setType(Type.MULTITYPE_LIST);
            for (Object entry : (List)value)
            {
                builder.addList(convertObjectToMultitype(entry));
            }
        }
        else
        {
            throw new IllegalArgumentException(
                    String.format("Cannot convert object [%s] to Multitype, invalid type: %s", 
                            value, value.getClass()));
        }
        return builder.build();
    }
@ SuppressWarnings ( { "rawtypes" } ) public static Multitype convertObjectToMultitype ( final Object value ) { final Multitype . Builder builder = Multitype . newBuilder ( ) ; if ( value == null ) { builder . setType ( Type . NONE ) ; } else if ( value instanceof Integer ) { builder . setType ( Type . INT32 ) ; builder . setInt32Value ( ( Integer ) value ) ; } else if ( value instanceof Long ) { builder . setType ( Type . INT64 ) ; builder . setInt64Value ( ( Long ) value ) ; } else if ( value instanceof String ) { builder . setType ( Type . STRING ) ; builder . setStringValue ( ( String ) value ) ; } else if ( value instanceof Boolean ) { builder . setType ( Type . BOOL ) ; builder . setBoolValue ( ( Boolean ) value ) ; } else if ( value instanceof Float ) { builder . setType ( Type . FLOAT ) ; builder . setFloatValue ( ( Float ) value ) ; } else if ( value instanceof Double ) { builder . setType ( Type . DOUBLE ) ; builder . setDoubleValue ( ( Double ) value ) ; } else if ( value instanceof Short ) { builder . setType ( Type . SHORT ) ; builder . setShortValue ( ( ( Short ) value ) . intValue ( ) ) ; } else if ( value instanceof Character ) { builder . setType ( Type . CHARACTER ) ; builder . setCharValue ( ( ( Character ) value ) . toString ( ) ) ; } else if ( value instanceof Byte ) { builder . setType ( Type . BYTE ) ; builder . setByteValue ( ( ( Byte ) value ) . intValue ( ) ) ; } else if ( value instanceof ByteString ) { builder . setType ( Type . BYTES ) ; builder . setByteStringValue ( ( ByteString ) value ) ; } else if ( value instanceof UUID ) { final UUID uuid = ( UUID ) value ; builder . setType ( Type . UUID ) ; builder . setUuidMostSigBitsValue ( uuid . getMostSignificantBits ( ) ) ; builder . setUuidLeastSigBitsValue ( uuid . getLeastSignificantBits ( ) ) ; } else if ( value instanceof List ) { builder . setType ( Type . MULTITYPE_LIST ) ; for ( Object entry : ( List ) value ) { builder . addList ( convertObjectToMultitype ( entry ) ) ; } } else { throw new IllegalArgumentException ( String . format ( "Cannot convert object [%s] to Multitype, invalid type: %s" , value , value . getClass ( ) ) ) ; } return builder . build ( ) ; }
Convert an object to a {@link Multitype} object that can be used within protocol buffer messages.
Convert an object to a { @link Multitype } object that can be used within protocol buffer messages .
//NOCHECKSTYLE -> Complexity is 14; Max is 12. Need breakdown of if statements to identify correct object type.