Interface Property<T extends net.tangly.bus.core.HasOid>

Type Parameters:
T - type of the entity owning the property.
All Known Implementing Classes:
PropertyCode, PropertyJson, PropertyOne2Many, PropertyOne2One, PropertySimple

public interface Property<T extends net.tangly.bus.core.HasOid>
Models the common attributes of an entity property. Conceptually three kinds of properties exist:
  • A property referencing a Java object or a Java primitive type. The object can be a single value or a collection. Single value object can either be persisted through standard JDBC mechanisms or through provided Function[S,T] transformers.
  • A single value property referencing another persisted entity persisted through a DAO.
  • A multiple value property referencing another persisted entity through a DAO
The property provides mechanisms to
  • Transform a SQL type value into a Java instance and set the property value with this instance.
  • Transform a Java instance into a SQL type value and set the corresponding prepared statement variable.
  • Transform a Java string into a SQL type value. The string can be read from a column of a TSV record.
  • Transform a SQL type value into a string. The string representation can be written into the corresponding column of a TSV record.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static class  Property.ConverterType  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Class<T> entity()
    Returns the type of the entity owning the property.
    java.lang.reflect.Field field()
    Returns the Java field associated with the property.
    default <P,​ V> V get​(T entity, @NotNull Property.ConverterType type)  
    <T,​ R> java.util.function.Function<T,​R> getConverter​(@NotNull Property.ConverterType type)  
    default void getParameter​(@NotNull java.sql.ResultSet set, int index, T entity)  
    java.lang.Class<?> jdbcType()  
    java.lang.String name()
    Returns the name of the property.
    default <P,​ V> void set​(T entity, V value, @NotNull Property.ConverterType type)  
    default void setParameter​(@NotNull java.sql.PreparedStatement statement, int index, T entity)  
    int sqlType()  
  • Method Details

    • name

      java.lang.String name()
      Returns the name of the property.
      Returns:
      name of the property
    • entity

      java.lang.Class<T> entity()
      Returns the type of the entity owning the property.
      Returns:
      type of the declaring entity
    • field

      java.lang.reflect.Field field()
      Returns the Java field associated with the property.
      Returns:
      field of the property
    • sqlType

      int sqlType()
    • jdbcType

      java.lang.Class<?> jdbcType()
    • getConverter

      <T,​ R> java.util.function.Function<T,​R> getConverter​(@NotNull @NotNull Property.ConverterType type)
    • get

      default <P,​ V> V get​(@NotNull T entity, @NotNull @NotNull Property.ConverterType type) throws java.security.PrivilegedActionException
      Throws:
      java.security.PrivilegedActionException
    • set

      default <P,​ V> void set​(@NotNull T entity, V value, @NotNull @NotNull Property.ConverterType type) throws java.security.PrivilegedActionException
      Throws:
      java.security.PrivilegedActionException
    • setParameter

      default void setParameter​(@NotNull @NotNull java.sql.PreparedStatement statement, int index, @NotNull T entity) throws java.security.PrivilegedActionException, java.sql.SQLException
      Throws:
      java.security.PrivilegedActionException
      java.sql.SQLException
    • getParameter

      default void getParameter​(@NotNull @NotNull java.sql.ResultSet set, int index, @NotNull T entity) throws java.security.PrivilegedActionException, java.sql.SQLException
      Throws:
      java.security.PrivilegedActionException
      java.sql.SQLException