当前位置: 首页>>代码示例>>Java>>正文


Java MapKeyEnumerated类代码示例

本文整理汇总了Java中javax.persistence.MapKeyEnumerated的典型用法代码示例。如果您正苦于以下问题:Java MapKeyEnumerated类的具体用法?Java MapKeyEnumerated怎么用?Java MapKeyEnumerated使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapKeyEnumerated类属于javax.persistence包,在下文中一共展示了MapKeyEnumerated类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMapKeyEnumerated

import javax.persistence.MapKeyEnumerated; //导入依赖的package包/类
/**
 * Adds a @MapKeyEnumerated annotation to the specified annotationList if the specified element
 * contains a map-key-enumerated sub-element. This should only be the case for
 * element-collection, many-to-many, or one-to-many associations.
 */
private void getMapKeyEnumerated(List<Annotation> annotationList, Element element) {
	Element subelement = element != null ? element.element( "map-key-enumerated" ) : null;
	if ( subelement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyEnumerated.class );
		EnumType value = EnumType.valueOf( subelement.getTextTrim() );
		ad.setValue( "value", value );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:JPAOverriddenAnnotationReader.java

示例2: prepare

import javax.persistence.MapKeyEnumerated; //导入依赖的package包/类
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 );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:56,代码来源:CollectionPropertyHolder.java


注:本文中的javax.persistence.MapKeyEnumerated类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。