Class MessageFieldArgument<M extends net.morimekta.providence.PMessage<M>>

  • Type Parameters:
    M - The message type.
    All Implemented Interfaces:
    org.jdbi.v3.core.argument.Argument

    public class MessageFieldArgument<M extends net.morimekta.providence.PMessage<M>>
    extends java.lang.Object
    implements org.jdbi.v3.core.argument.Argument
    Smart mapping of message fields to SQL bound argument. It will map the type to whichever type is default or selected (if supported) for most field types.
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageFieldArgument​(net.morimekta.providence.PMessageOrBuilder<M> message, net.morimekta.providence.descriptor.PField<M> field)
      Create a message field argument.
      MessageFieldArgument​(net.morimekta.providence.PMessageOrBuilder<M> message, net.morimekta.providence.descriptor.PField<M> field, int type)
      Create a message field argument.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(int position, java.sql.PreparedStatement statement, org.jdbi.v3.core.statement.StatementContext ctx)  
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MessageFieldArgument

        public MessageFieldArgument​(@Nonnull
                                    net.morimekta.providence.PMessageOrBuilder<M> message,
                                    @Nonnull
                                    net.morimekta.providence.descriptor.PField<M> field)
        Create a message field argument.
        Parameters:
        message - The message to get the field from.
        field - The field to select.
      • MessageFieldArgument

        public MessageFieldArgument​(@Nonnull
                                    net.morimekta.providence.PMessageOrBuilder<M> message,
                                    @Nonnull
                                    net.morimekta.providence.descriptor.PField<M> field,
                                    int type)
        Create a message field argument.
        Parameters:
        message - The message to get the field from.
        field - The field to select.
        type - The SQL type. See Types.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • apply

        public void apply​(int position,
                          java.sql.PreparedStatement statement,
                          org.jdbi.v3.core.statement.StatementContext ctx)
                   throws java.sql.SQLException
        Specified by:
        apply in interface org.jdbi.v3.core.argument.Argument
        Throws:
        java.sql.SQLException