类javax.persistence.Temporal源码实例Demo

下面列出了怎么用javax.persistence.Temporal的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: o2oa   文件: DynamicEntityBuilder.java
private void createDateField(Builder builder, Field field) {

		AnnotationSpec column = AnnotationSpec.builder(Column.class)
				.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();

		AnnotationSpec temporal = AnnotationSpec.builder(Temporal.class)
				.addMember("value", "javax.persistence.TemporalType.DATE").build();
		FieldSpec fieldSpec = FieldSpec.builder(Date.class, field.getName(), Modifier.PRIVATE)
				.addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field))
				.addAnnotation(this.checkPersist(field)).addAnnotation(column).addAnnotation(temporal).build();
		MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(Date.class).addStatement("return this." + field.getName())
				.build();
		MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(Date.class, field.getName())
				.addStatement("this." + field.getName() + " = " + field.getName()).build();
		builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set);

	}
 
源代码2 项目: o2oa   文件: DynamicEntityBuilder.java
private void createDateTimeField(Builder builder, Field field) {

		AnnotationSpec column = AnnotationSpec.builder(Column.class)
				.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();

		AnnotationSpec temporal = AnnotationSpec.builder(Temporal.class)
				.addMember("value", "javax.persistence.TemporalType.TIMESTAMP").build();

		FieldSpec fieldSpec = FieldSpec.builder(Date.class, field.getName(), Modifier.PRIVATE)
				.addAnnotation(this.fieldDescribe(field)).addAnnotation(this.index(field))
				.addAnnotation(this.checkPersist(field)).addAnnotation(column).addAnnotation(temporal).build();
		MethodSpec get = MethodSpec.methodBuilder("get" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(Date.class).addStatement("return this." + field.getName())
				.build();
		MethodSpec set = MethodSpec.methodBuilder("set" + StringUtils.capitalize(field.getName()))
				.addModifiers(Modifier.PUBLIC).returns(void.class).addParameter(Date.class, field.getName())
				.addStatement("this." + field.getName() + " = " + field.getName()).build();
		builder.addField(this.fieldName(field)).addField(fieldSpec).addMethod(get).addMethod(set);

	}
 
源代码3 项目: lams   文件: JPAOverriddenAnnotationReader.java
private void getTemporal(List<Annotation> annotationList, Element element) {
	Element subElement = element != null ? element.element( "temporal" ) : null;
	if ( subElement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Temporal.class );
		String temporal = subElement.getTextTrim();
		if ( "DATE".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.DATE );
		}
		else if ( "TIME".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIME );
		}
		else if ( "TIMESTAMP".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIMESTAMP );
		}
		else if ( StringHelper.isNotEmpty( temporal ) ) {
			throw new AnnotationException( "Unknown TemporalType: " + temporal + ". " + SCHEMA_VALIDATION );
		}
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
源代码4 项目: tephra   文件: ModelTableImpl.java
@Override
public void addGetMethod(String name, Method method) {
    getMethods.put(name, method);
    Jsonable jsonable = method.getAnnotation(Jsonable.class);
    if (jsonable != null)
        jsonables.put(name, jsonable);
    ManyToOne manyToOne = method.getAnnotation(ManyToOne.class);
    if (manyToOne != null)
        manyToOnes.put(name, manyToOne);

    Class<?> type = method.getReturnType();
    Temporal temporal = method.getAnnotation(Temporal.class);
    if (temporal != null) {
        if (TemporalType.DATE.equals(temporal.value()))
            type = Date.class;
        else if (TemporalType.TIMESTAMP.equals(temporal.value()))
            type = Timestamp.class;
    }
    types.put(name, type);
    addLowerCase(name);
}
 
源代码5 项目: cia   文件: SwedenPoliticalParty.java
/**
* Gets the registered date.
*
* @return the registered date
*/
  @Basic
  @Column(name = "REGISTERED_DATE")
  @Temporal(TemporalType.DATE)
  public Date getRegisteredDate() {
      return registeredDate;
  }
 
源代码6 项目: cia   文件: DocumentData.java
/**
* Gets the made public date.
*
* @return the made public date
*/
  @Basic
  @Column(name = "MADE_PUBLIC_DATE")
  @Temporal(TemporalType.DATE)
  public Date getMadePublicDate() {
      return madePublicDate;
  }
 
源代码7 项目: cia   文件: CommitteeDocumentData.java
/**
* Gets the created date.
*
* @return the created date
*/
  @Basic
  @Column(name = "CREATED_DATE")
  @Temporal(TemporalType.DATE)
  public Date getCreatedDate() {
      return createdDate;
  }
 
@Temporal(TemporalType.DATE)
@Column(name = "INS_CLASSES_END_DATE", length = 7)
public Date getEndDate() {
	return this.endDate;
}
 
源代码9 项目: we-cmdb   文件: AdmUserAccess.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "acc_time")
public Date getAccTime() {
    return this.accTime;
}
 
源代码10 项目: we-cmdb   文件: AdmOperateRecord.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "start_time")
public Date getStartTime() {
    return this.startTime;
}
 
源代码11 项目: we-cmdb   文件: VersionTable.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "version_date")
public Date getVersionDate() {
    return this.versionDate;
}
 
源代码12 项目: TinyMooc   文件: OperationLog.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LOG_DATE", length = 19)
public Date getLogDate() {
    return this.logDate;
}
 
源代码13 项目: TinyMooc   文件: Authority.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATE_DATE", length = 19)
public Date getUpdateDate() {
    return this.updateDate;
}
 
源代码14 项目: pacbot   文件: RhnSystemDetails.java
/**
 * Gets the creates the date.
 *
 * @return the creates the date
 */
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "createDate", length = 19)
public Date getCreateDate() {
    return this.createDate;
}
 
源代码15 项目: pacbot   文件: RhnSystemDetails.java
/**
 * Gets the modified date.
 *
 * @return the modified date
 */
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "modifiedDate", length = 19)
public Date getModifiedDate() {
    return this.modifiedDate;
}
 
源代码16 项目: pacbot   文件: RhnSystemDetails.java
/**
 * Gets the last checked in.
 *
 * @return the last checked in
 */
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "lastCheckedIn", length = 19)
public Date getLastCheckedIn() {
    return this.lastCheckedIn;
}
 
源代码17 项目: aws-photosharing-example   文件: User.java
@Temporal(TemporalType.TIMESTAMP)
public Date getLastLogin() {return lastLogin;}
 
源代码18 项目: aws-photosharing-example   文件: Media.java
@Temporal(TemporalType.TIMESTAMP)
public Date getPresignedUrlExpires() {return this.presignedUrlExpires;}
 
源代码19 项目: TinyMooc   文件: Favorite.java
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "FAVORITE_DATE", length = 19)
public Date getFavoriteDate() {
    return this.favoriteDate;
}
 
源代码20 项目: lams   文件: SimpleValueBinder.java
private void applyAttributeConverter(XProperty property, ConverterDescriptor attributeConverterDescriptor) {
	if ( attributeConverterDescriptor == null ) {
		return;
	}

	LOG.debugf( "Starting applyAttributeConverter [%s:%s]", persistentClassName, property.getName() );

	if ( property.isAnnotationPresent( Id.class ) ) {
		LOG.debugf( "Skipping AttributeConverter checks for Id attribute [%s]", property.getName() );
		return;
	}

	if ( isVersion ) {
		LOG.debugf( "Skipping AttributeConverter checks for version attribute [%s]", property.getName() );
		return;
	}

	if ( !key && property.isAnnotationPresent( Temporal.class ) ) {
		LOG.debugf( "Skipping AttributeConverter checks for Temporal attribute [%s]", property.getName() );
		return;
	}
	if ( key && property.isAnnotationPresent( MapKeyTemporal.class ) ) {
		LOG.debugf( "Skipping AttributeConverter checks for map-key annotated as MapKeyTemporal [%s]", property.getName() );
		return;
	}

	if ( !key && property.isAnnotationPresent( Enumerated.class ) ) {
		LOG.debugf( "Skipping AttributeConverter checks for Enumerated attribute [%s]", property.getName() );
		return;
	}
	if ( key && property.isAnnotationPresent( MapKeyEnumerated.class ) ) {
		LOG.debugf( "Skipping AttributeConverter checks for map-key annotated as MapKeyEnumerated [%s]", property.getName() );
		return;
	}

	if ( isAssociation() ) {
		LOG.debugf( "Skipping AttributeConverter checks for association attribute [%s]", property.getName() );
		return;
	}

	this.attributeConverterDescriptor = attributeConverterDescriptor;
}
 
源代码21 项目: Spring-MVC-Blueprints   文件: CustomerAccount.java
@Temporal(TemporalType.DATE)
@Column(name = "birthDate", nullable = false, length = 10)
public Date getBirthDate() {
	return this.birthDate;
}
 
源代码22 项目: Spring-MVC-Blueprints   文件: CustomerAccount.java
@Temporal(TemporalType.DATE)
@Column(name = "startDate", nullable = false, length = 10)
public Date getStartDate() {
	return this.startDate;
}
 
源代码23 项目: Spring-MVC-Blueprints   文件: Catalog.java
@Temporal(TemporalType.DATE)
@Column(name = "expiry", nullable = false, length = 10)
public Date getExpiry() {
	return this.expiry;
}
 
源代码24 项目: Spring-MVC-Blueprints   文件: CustomerAccount.java
@Temporal(TemporalType.DATE)
@Column(name = "birthDate", nullable = false, length = 10)
public Date getBirthDate() {
	return this.birthDate;
}
 
源代码25 项目: Spring-MVC-Blueprints   文件: CustomerAccount.java
@Temporal(TemporalType.DATE)
@Column(name = "startDate", nullable = false, length = 10)
public Date getStartDate() {
	return this.startDate;
}
 
源代码26 项目: Spring-MVC-Blueprints   文件: Person.java
@Temporal(TemporalType.DATE)
@Column(name = "birthDate", length = 10)
public Date getBirthDate() {
	return this.birthDate;
}
 
源代码27 项目: Spring-MVC-Blueprints   文件: Invoice.java
@Temporal(TemporalType.DATE)
@Column(name = "date", nullable = false, length = 10)
public Date getDate() {
	return this.date;
}
 
源代码28 项目: Spring-MVC-Blueprints   文件: User.java
@Temporal(TemporalType.DATE)
@Column(name = "birthDate", nullable = false, length = 10)
public Date getBirthDate() {
	return this.birthDate;
}
 
源代码29 项目: Spring-MVC-Blueprints   文件: PurchaseOrder.java
@Temporal(TemporalType.DATE)
@Column(name = "date", nullable = false, length = 10)
public Date getDate() {
	return this.date;
}
 
源代码30 项目: Spring-MVC-Blueprints   文件: Tblstudents.java
@Temporal(TemporalType.DATE)
@Column(name = "birthDate", nullable = false, length = 10)
public Date getBirthDate() {
	return this.birthDate;
}
 
 类所在包
 同包方法