當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessType類代碼示例

本文整理匯總了Java中javax.persistence.AccessType的典型用法代碼示例。如果您正苦於以下問題:Java AccessType類的具體用法?Java AccessType怎麽用?Java AccessType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AccessType類屬於javax.persistence包,在下文中一共展示了AccessType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的javax.persistence.AccessType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。