private static List<Field> getEntityCreateDate(Class<?> entityClass) { List<Field> fieldList = new ArrayList<>(1); for (Field field : entityClass.getDeclaredFields()) { if (field.isAnnotationPresent(CreatedDate.class)) { fieldList.add(field); } } return fieldList; }
/** * Creates a new {@link AbstractEntityInformation} from the given domain class. * * @param domainClass must not be {@literal null}. */ protected MybatisMetamodelEntityInformation(PersistentEntity<T, ?> persistentEntity, AuditorAware<?> auditorAware, AuditDateAware<?> auditDateAware, Class<T> domainClass) { super(persistentEntity, auditorAware, auditDateAware, domainClass); createdDateProperty = persistentEntity.getPersistentProperty(CreatedDate.class); lastModifiedDateProperty = persistentEntity.getPersistentProperty(LastModifiedDate.class); createdByProperty = persistentEntity.getPersistentProperty(CreatedBy.class); lastModifiedByProperty = persistentEntity.getPersistentProperty(LastModifiedBy.class); }
@Override public void setCreatedDate(T entity) { if (null == createdDateProperty) { return; } setAuditDate(createdDateProperty, entity, CreatedDate.class); }
@Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentLocalDateTime") @CreatedDate public ZonedDateTime getPostDate() { return postDate; }
@Override @Column(name = "date_created") @CreatedDate public Date getDateCreated() { return dateCreated != null ? (Date)dateCreated : null; }
@CreatedDate public void setCreatedAt(final Long createdAt) { this.createdAt = createdAt; }
/** * Gets the createon. * * @return the createon */ @CreatedDate @Temporal(TemporalType.TIMESTAMP) public Date getCreateon() { return createon; }
@CreatedDate @Temporal(TemporalType.TIMESTAMP) @Column(name = "CREATED", nullable = true) public Date getCreated() { return created; }