类javax.persistence.MapKeyTemporal源码实例Demo

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

源代码1 项目: lams   文件: JPAOverriddenAnnotationReader.java
/**
 * Adds a @MapKeyTemporal annotation to the specified annotationList if the specified element
 * contains a map-key-temporal sub-element. This should only be the case for element-collection,
 * many-to-many, or one-to-many associations.
 */
private void getMapKeyTemporal(List<Annotation> annotationList, Element element) {
	Element subelement = element != null ? element.element( "map-key-temporal" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyTemporal.class );
		TemporalType value = TemporalType.valueOf( subelement.getTextTrim() );
		ad.setValue( "value", value );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
源代码2 项目: lams   文件: CollectionPropertyHolder.java
public void prepare(XProperty collectionProperty) {
	// fugly
	if ( prepared ) {
		return;
	}

	if ( collectionProperty == null ) {
		return;
	}

	prepared = true;

	if ( collection.isMap() ) {
		if ( collectionProperty.isAnnotationPresent( MapKeyEnumerated.class ) ) {
			canKeyBeConverted = false;
		}
		else if ( collectionProperty.isAnnotationPresent( MapKeyTemporal.class ) ) {
			canKeyBeConverted = false;
		}
		else if ( collectionProperty.isAnnotationPresent( MapKeyClass.class ) ) {
			canKeyBeConverted = false;
		}
		else if ( collectionProperty.isAnnotationPresent( MapKeyType.class ) ) {
			canKeyBeConverted = false;
		}
	}
	else {
		canKeyBeConverted = false;
	}

	if ( collectionProperty.isAnnotationPresent( ManyToAny.class ) ) {
		canElementBeConverted = false;
	}
	else if ( collectionProperty.isAnnotationPresent( OneToMany.class ) ) {
		canElementBeConverted = false;
	}
	else if ( collectionProperty.isAnnotationPresent( ManyToMany.class ) ) {
		canElementBeConverted = false;
	}
	else if ( collectionProperty.isAnnotationPresent( Enumerated.class ) ) {
		canElementBeConverted = false;
	}
	else if ( collectionProperty.isAnnotationPresent( Temporal.class ) ) {
		canElementBeConverted = false;
	}
	else if ( collectionProperty.isAnnotationPresent( CollectionType.class ) ) {
		canElementBeConverted = false;
	}

	// Is it valid to reference a collection attribute in a @Convert attached to the owner (entity) by path?
	// if so we should pass in 'clazzToProcess' also
	if ( canKeyBeConverted || canElementBeConverted ) {
		buildAttributeConversionInfoMaps( collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap );
	}
}
 
源代码3 项目: 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;
}
 
 类所在包
 类方法
 同包方法