Package net.morimekta.providence.jdbi.v3
Class MessageFieldArgument<M extends net.morimekta.providence.PMessage<M>>
- java.lang.Object
-
- net.morimekta.providence.jdbi.v3.MessageFieldArgument<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()
-
-
-
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. SeeTypes
.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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 interfaceorg.jdbi.v3.core.argument.Argument
- Throws:
java.sql.SQLException
-
-