下面列出了怎么用javax.persistence.Cacheable的API类实例代码及写法,或者点击链接到github查看源代码。
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;
}
}
@Override
public boolean isCacheable() {
return annotationOf(Entity.class).map(Entity::cacheable)
.orElse( annotationOf(Cacheable.class).map(Cacheable::value).orElse(true));
}