请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AccessType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isProcessingId

import javax.persistence.AccessType; //导入依赖的package包/类
private boolean isProcessingId(XMLContext.Default defaults) {
	boolean isExplicit = defaults.getAccess() != null;
	boolean correctAccess =
			( PropertyType.PROPERTY.equals( propertyType ) && AccessType.PROPERTY.equals( defaults.getAccess() ) )
					|| ( PropertyType.FIELD.equals( propertyType ) && AccessType.FIELD
					.equals( defaults.getAccess() ) );
	boolean hasId = defaults.canUseJavaAnnotations()
			&& ( isPhysicalAnnotationPresent( Id.class ) || isPhysicalAnnotationPresent( EmbeddedId.class ) );
	//if ( properAccessOnMetadataComplete || properOverridingOnMetadataNonComplete ) {
	boolean mirrorAttributeIsId = defaults.canUseJavaAnnotations() &&
			( mirroredAttribute != null &&
					( mirroredAttribute.isAnnotationPresent( Id.class )
							|| mirroredAttribute.isAnnotationPresent( EmbeddedId.class ) ) );
	boolean propertyIsDefault = PropertyType.PROPERTY.equals( propertyType )
			&& !mirrorAttributeIsId;
	return correctAccess || ( !isExplicit && hasId ) || ( !isExplicit && propertyIsDefault );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:JPAOverriddenAnnotationReader.java


示例2: getAccessType

import javax.persistence.AccessType; //导入依赖的package包/类
private void getAccessType(List<Annotation> annotationList, Element element) {
	if ( element == null ) {
		return;
	}
	String access = element.attributeValue( "access" );
	if ( access != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Access.class );
		AccessType type;
		try {
			type = AccessType.valueOf( access );
		}
		catch ( IllegalArgumentException e ) {
			throw new AnnotationException( access + " is not a valid access type. Check you xml confguration." );
		}

		if ( ( AccessType.PROPERTY.equals( type ) && this.element instanceof Method ) ||
				( AccessType.FIELD.equals( type ) && this.element instanceof Field ) ) {
			return;
		}

		ad.setValue( "value", type );
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JPAOverriddenAnnotationReader.java


示例3: EmbeddableHierarchy

import javax.persistence.AccessType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private EmbeddableHierarchy(
		List<ClassInfo> classInfoList,
		String propertyName,
		AnnotationBindingContext context,
		AccessType defaultAccessType) {
	this.defaultAccessType = defaultAccessType;

	// the resolved type for the top level class in the hierarchy
	context.resolveAllTypes( classInfoList.get( classInfoList.size() - 1 ).name().toString() );

	embeddables = new ArrayList<EmbeddableClass>();
	ConfiguredClass parent = null;
	EmbeddableClass embeddable;
	for ( ClassInfo info : classInfoList ) {
		embeddable = new EmbeddableClass(
				info, propertyName, parent, defaultAccessType, context
		);
		embeddables.add( embeddable );
		parent = embeddable;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:EmbeddableHierarchy.java


示例4: ConfiguredClass

import javax.persistence.AccessType; //导入依赖的package包/类
public ConfiguredClass(
		ClassInfo classInfo,
		AccessType defaultAccessType,
		ConfiguredClass parent,
		AnnotationBindingContext context) {
	this.parent = parent;
	this.classInfo = classInfo;
	this.clazz = context.locateClassByName( classInfo.toString() );
	this.configuredClassType = determineType();
	this.classAccessType = determineClassAccessType( defaultAccessType );
	this.customTuplizer = determineCustomTuplizer();

	this.simpleAttributeMap = new TreeMap<String, BasicAttribute>();
	this.idAttributeMap = new TreeMap<String, BasicAttribute>();
	this.associationAttributeMap = new TreeMap<String, AssociationAttribute>();

	this.localBindingContext = new EntityBindingContext( context, this );

	collectAttributes();
	attributeOverrideMap = Collections.unmodifiableMap( findAttributeOverrides() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ConfiguredClass.java


示例5: determineDefaultAccessType

import javax.persistence.AccessType; //导入依赖的package包/类
/**
 * @param classes the classes in the hierarchy
 *
 * @return Returns the default access type for the configured class hierarchy independent of explicit
 *         {@code AccessType} annotations. The default access type is determined by the placement of the
 *         annotations.
 */
private static AccessType determineDefaultAccessType(List<ClassInfo> classes) {
	AccessType accessTypeByEmbeddedIdPlacement = null;
	AccessType accessTypeByIdPlacement = null;
	for ( ClassInfo info : classes ) {
		List<AnnotationInstance> idAnnotations = info.annotations().get( JPADotNames.ID );
		List<AnnotationInstance> embeddedIdAnnotations = info.annotations().get( JPADotNames.EMBEDDED_ID );

		if ( CollectionHelper.isNotEmpty( embeddedIdAnnotations ) ) {
			accessTypeByEmbeddedIdPlacement = determineAccessTypeByIdPlacement( embeddedIdAnnotations );
		}
		if ( CollectionHelper.isNotEmpty( idAnnotations ) ) {
			accessTypeByIdPlacement = determineAccessTypeByIdPlacement( idAnnotations );
		}
	}
	if ( accessTypeByEmbeddedIdPlacement != null ) {
		return accessTypeByEmbeddedIdPlacement;
	}
	else if ( accessTypeByIdPlacement != null ) {
		return accessTypeByIdPlacement;
	}
	else {
		return throwIdNotFoundAnnotationException( classes );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:EntityHierarchyBuilder.java


示例6: determineAccessTypeByIdPlacement

import javax.persistence.AccessType; //导入依赖的package包/类
private static AccessType determineAccessTypeByIdPlacement(List<AnnotationInstance> idAnnotations) {
	AccessType accessType = null;
	for ( AnnotationInstance annotation : idAnnotations ) {
		AccessType tmpAccessType;
		if ( annotation.target() instanceof FieldInfo ) {
			tmpAccessType = AccessType.FIELD;
		}
		else if ( annotation.target() instanceof MethodInfo ) {
			tmpAccessType = AccessType.PROPERTY;
		}
		else {
			throw new AnnotationException( "Invalid placement of @Id annotation" );
		}

		if ( accessType == null ) {
			accessType = tmpAccessType;
		}
		else {
			if ( !accessType.equals( tmpAccessType ) ) {
				throw new AnnotationException( "Inconsistent placement of @Id annotation within hierarchy " );
			}
		}
	}
	return accessType;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:EntityHierarchyBuilder.java


示例7: getAccessFromIndex

import javax.persistence.AccessType; //导入依赖的package包/类
protected AccessType getAccessFromIndex(DotName className) {
	Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
	List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS );
	if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
		for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
			if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
				ClassInfo ci = (ClassInfo) ( annotationInstance.target() );
				if ( className.equals( ci.name() ) ) {
					//todo does ci need to have @Entity or @MappedSuperClass ??
					return AccessType.valueOf( annotationInstance.value().asEnum() );
				}
			}
		}
	}
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EntityMocker.java


示例8: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Override
@Id
@Size(min = 16, max = 255)
@Access(value = AccessType.PROPERTY)
@Column(name = "token_data", nullable = false, length = 255)
public String getId() {
    return id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:EmailToken.java


示例9: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "srva_event_id", nullable = false)
@Access(value = AccessType.PROPERTY)
@Override
public Long getId() {
    return id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:SrvaEvent.java


示例10: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
@Access(value = AccessType.PROPERTY)
@Override
public Long getId() {
    return id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:ObservationContextSensitiveFields.java


示例11: setAccess

import javax.persistence.AccessType; //导入依赖的package包/类
private void setAccess( String access, Default defaultType) {
	AccessType type;
	if ( access != null ) {
		try {
			type = AccessType.valueOf( access );
		}
		catch ( IllegalArgumentException e ) {
			throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
		}
		defaultType.setAccess( type );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:XMLContext.java


示例12: EntityClass

import javax.persistence.AccessType; //导入依赖的package包/类
public EntityClass(
		ClassInfo classInfo,
		EntityClass parent,
		AccessType hierarchyAccessType,
		InheritanceType inheritanceType,
		AnnotationBindingContext context) {
	super( classInfo, hierarchyAccessType, parent, context );
	this.inheritanceType = inheritanceType;
	this.idType = determineIdType();
	boolean hasOwnTable = definesItsOwnTable();
	this.explicitEntityName = determineExplicitEntityName();
	this.constraintSources = new HashSet<ConstraintSource>();

	if ( hasOwnTable ) {
		AnnotationInstance tableAnnotation = JandexHelper.getSingleAnnotation(
				getClassInfo(),
				JPADotNames.TABLE
		);
		this.primaryTableSource = createTableSource( tableAnnotation );
	}
	else {
		this.primaryTableSource = null;
	}

	this.secondaryTableSources = createSecondaryTableSources();
	this.customLoaderQueryName = determineCustomLoader();
	this.synchronizedTableNames = determineSynchronizedTableNames();
	this.batchSize = determineBatchSize();
	this.jpaCallbacks = determineEntityListeners();

	processHibernateEntitySpecificAnnotations();
	processCustomSqlAnnotations();
	processProxyGeneration();
	processDiscriminator();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:EntityClass.java


示例13: determineClassAccessType

import javax.persistence.AccessType; //导入依赖的package包/类
private AccessType determineClassAccessType(AccessType defaultAccessType) {
	// default to the hierarchy access type to start with
	AccessType accessType = defaultAccessType;

	AnnotationInstance accessAnnotation = JandexHelper.getSingleAnnotation( classInfo, JPADotNames.ACCESS );
	if ( accessAnnotation != null && accessAnnotation.target().getClass().equals( ClassInfo.class ) ) {
		accessType = JandexHelper.getEnumValue( accessAnnotation, "value", AccessType.class );
	}

	return accessType;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:ConfiguredClass.java


示例14: EmbeddableClass

import javax.persistence.AccessType; //导入依赖的package包/类
public EmbeddableClass(
		ClassInfo classInfo,
		String embeddedAttributeName,
		ConfiguredClass parent,
		AccessType defaultAccessType,
		AnnotationBindingContext context) {
	super( classInfo, defaultAccessType, parent, context );
	this.embeddedAttributeName = embeddedAttributeName;
	this.parentReferencingAttributeName = checkParentAnnotation();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:EmbeddableClass.java


示例15: addSubclassEntitySources

import javax.persistence.AccessType; //导入依赖的package包/类
private static void addSubclassEntitySources(AnnotationBindingContext bindingContext,
											 Map<DotName, List<ClassInfo>> classToDirectSubClassMap,
											 AccessType defaultAccessType,
											 InheritanceType hierarchyInheritanceType,
											 EntityClass entityClass,
											 EntitySource entitySource) {
	List<ClassInfo> subClassInfoList = classToDirectSubClassMap.get( DotName.createSimple( entitySource.getClassName() ) );
	if ( subClassInfoList == null ) {
		return;
	}
	for ( ClassInfo subClassInfo : subClassInfoList ) {
		EntityClass subclassEntityClass = new EntityClass(
				subClassInfo,
				entityClass,
				defaultAccessType,
				hierarchyInheritanceType,
				bindingContext
		);
		SubclassEntitySource subclassEntitySource = new SubclassEntitySourceImpl( subclassEntityClass );
		entitySource.add( subclassEntitySource );
		addSubclassEntitySources(
				bindingContext,
				classToDirectSubClassMap,
				defaultAccessType,
				hierarchyInheritanceType,
				subclassEntityClass,
				subclassEntitySource
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:EntityHierarchyBuilder.java


示例16: getDefaultAccess

import javax.persistence.AccessType; //导入依赖的package包/类
protected AccessType getDefaultAccess() {
	if ( entity.getAccess() != null ) {
		return AccessType.valueOf( entity.getAccess().value() );
	}

	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:EntityMocker.java


示例17: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Override
@Id
@Access(value = AccessType.PROPERTY)
@Column(name = "integration_id", nullable = false)
@Size(max = 255)
public String getId() {
    return this.id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:Integration.java


示例18: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = AccessType.PROPERTY)
@Column(name = "announcement_subscriber_id", nullable = false)
public Long getId() {
    return id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:AnnouncementSubscriber.java


示例19: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = AccessType.PROPERTY)
@Column(name = "announcement_id", nullable = false)
public Long getId() {
    return id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:Announcement.java


示例20: getId

import javax.persistence.AccessType; //导入依赖的package包/类
@Override
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Access(value = AccessType.PROPERTY)
@Column(name = ID_COLUMN_NAME, nullable = false)
public Long getId() {
    return this.id;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:9,代码来源:HuntingClubArea.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Alternative类代码示例发布时间:2022-05-20
下一篇:
Java MethodDescriptor类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap