当前位置: 首页>>代码示例>>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;未经允许,请勿转载。