001package io.ebean.event;
002
003import io.ebean.Database;
004
005/**
006 * Fired after a bean is constructed, but not yet loaded from database.
007 * <p>
008 * Note: You MUST NOT set any default values, as in a following step,
009 * properties will get unload. Use {@link BeanPostLoad} instead.
010 * <p>
011 * it's intended to do some dependency-injection here.
012 * If you plan to use this feature you should use {@link Database#createEntityBean(Class)}
013 * to create new beans.
014 * </p>
015 */
016public interface BeanPostConstructListener {
017
018  /**
019   * Return true if this BeanPostConstructListener instance should be registered
020   * for post construct on this entity type.
021   */
022  boolean isRegisterFor(Class<?> cls);
023
024  /**
025   * Called immediately after construction. Perform DI here.
026   */
027  void autowire(Object bean);
028
029  /**
030   * Called after every &#64;PostConstruct annotated method of the bean is executed
031   */
032  void postConstruct(Object bean);
033
034  /**
035   * Called after {@link Database#createEntityBean(Class)}. Only for new beans.
036   * intended to set default values here.
037   */
038  void postCreate(Object bean);
039
040}