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


Java Cacheable類代碼示例

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


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

示例1: getCacheable

import javax.persistence.Cacheable; //導入依賴的package包/類
private Cacheable getCacheable(Element element, XMLContext.Default defaults){
	if ( element != null ) {
		String attValue = element.attributeValue( "cacheable" );
		if ( attValue != null ) {
			AnnotationDescriptor ad = new AnnotationDescriptor( Cacheable.class );
			ad.setValue( "value", Boolean.valueOf( attValue ) );
			return AnnotationFactory.create( ad );
		}
	}
	if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( Cacheable.class );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:JPAOverriddenAnnotationReader.java

示例2: determineCacheSettings

import javax.persistence.Cacheable; //導入依賴的package包/類
private static Cache determineCacheSettings(XClass clazzToProcess, Mappings mappings) {
	Cache cacheAnn = clazzToProcess.getAnnotation( Cache.class );
	if ( cacheAnn != null ) {
		return cacheAnn;
	}

	Cacheable cacheableAnn = clazzToProcess.getAnnotation( Cacheable.class );
	SharedCacheMode mode = determineSharedCacheMode( mappings );
	switch ( mode ) {
		case ALL: {
			cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
			break;
		}
		case ENABLE_SELECTIVE: {
			if ( cacheableAnn != null && cacheableAnn.value() ) {
				cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
			}
			break;
		}
		case DISABLE_SELECTIVE: {
			if ( cacheableAnn == null || cacheableAnn.value() ) {
				cacheAnn = buildCacheMock( clazzToProcess.getName(), mappings );
			}
			break;
		}
		default: {
			// treat both NONE and UNSPECIFIED the same
			break;
		}
	}
	return cacheAnn;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:33,代碼來源:AnnotationBinder.java

示例3: initByAnno

import javax.persistence.Cacheable; //導入依賴的package包/類
protected void initByAnno(Class<?> thisType, AnnotationProvider annos) {
	// schema初始化
	Table table = annos.getAnnotation(javax.persistence.Table.class);
	if (table != null) {
		if (table.schema().length() > 0) {
			schema = MetaHolder.getMappingSchema(table.schema());// 重定向
		}
		if (table.name().length() > 0) {
			tableName = table.name();
		}
		for(javax.persistence.Index index: table.indexes()){
			this.indexes.add(IndexDef.create(index));
		}
		for(javax.persistence.UniqueConstraint unique: table.uniqueConstraints()){
			this.uniques.add(new UniqueConstraintDef(unique));
		}
	}
	if (tableName == null) {
		// 表名未指定,缺省生成
		boolean needTranslate = JefConfiguration.getBoolean(DbCfg.TABLE_NAME_TRANSLATE, false);
		if (needTranslate) {
			tableName = DbUtils.upperToUnderline(thisType.getSimpleName());
		} else {
			tableName = thisType.getSimpleName();
		}
	}
	BindDataSource bindDs = annos.getAnnotation(BindDataSource.class);
	if (bindDs != null) {
		this.bindDsName = MetaHolder.getMappingSite(StringUtils.trimToNull(bindDs.value()));
	}

	Cacheable cache = annos.getAnnotation(Cacheable.class);
	this.cacheable = cache != null && cache.value();

	EasyEntity entity = annos.getAnnotation(EasyEntity.class);
	if (entity != null) {
		this.useOuterJoin = entity.useOuterJoin();
	}
}
 
開發者ID:GeeQuery,項目名稱:ef-orm,代碼行數:40,代碼來源:TableMetadata.java

示例4: isCacheable

import javax.persistence.Cacheable; //導入依賴的package包/類
@Override
public boolean isCacheable() {
    return annotationOf(Entity.class).map(Entity::cacheable)
        .orElse( annotationOf(Cacheable.class).map(Cacheable::value).orElse(true));
}
 
開發者ID:requery,項目名稱:requery,代碼行數:6,代碼來源:EntityType.java


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