当前位置: 首页>>代码示例>>Java>>正文


Java Immutable类代码示例

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


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

示例1: testIsVersioned

import org.hibernate.annotations.Immutable; //导入依赖的package包/类
/**
 * Test that the entity is versioned, that the name of the version property is "version",
 * and that the version property is not nullable.
 */
private void testIsVersioned()
{
  
  org.hibernate.annotations.Entity entityAnnotation =
    _entityClass.getAnnotation(org.hibernate.annotations.Entity.class);
  if (entityAnnotation != null && ! entityAnnotation.mutable()) {
    return;
  }
  if (_entityClass.getAnnotation(Immutable.class) != null) {
    return;
  }
    
  ManagedType<? extends AbstractEntity> type = _entityManagerFactory.getMetamodel().managedType(_entityClass);
  SingularAttribute id = ((IdentifiableType) type).getId(((IdentifiableType) type).getIdType().getJavaType());
  assertTrue("hibernate class is versioned: " + _entityClass, ((IdentifiableType) type).hasVersionAttribute());
  
  assertFalse("version property is not nullable: " + _entityClass, ((IdentifiableType) type).getVersion(Integer.class).isOptional());
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:23,代码来源:IsVersionedTester.java

示例2: validateBind

import org.hibernate.annotations.Immutable; //导入依赖的package包/类
private void validateBind() {
	if ( property.isAnnotationPresent( Immutable.class ) ) {
		throw new AnnotationException(
				"@Immutable on property not allowed. " +
						"Only allowed on entity level or on a collection."
		);
	}
	if ( !declaringClassSet ) {
		throw new AssertionFailure( "declaringClass has not been set before a bind" );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:PropertyBinder.java

示例3: isImmutableProperty

import org.hibernate.annotations.Immutable; //导入依赖的package包/类
public static boolean isImmutableProperty(Class<? extends AbstractEntity> beanClass, PropertyDescriptor propertyDescriptor)
{
  org.hibernate.annotations.Entity entityAnnotation =
    beanClass.getAnnotation(org.hibernate.annotations.Entity.class);
  if (entityAnnotation != null && ! entityAnnotation.mutable()) {
    return true;
  }
  if (beanClass.getAnnotation(Immutable.class) != null) {
    return true;
  }
  Method getter = propertyDescriptor.getReadMethod();
  javax.persistence.Column columnAnnot = getter.getAnnotation(javax.persistence.Column.class);
  return columnAnnot != null && !columnAnnot.updatable();
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:15,代码来源:ModelIntrospectionUtil.java

示例4: isImmutableIgnoreTests

import org.hibernate.annotations.Immutable; //导入依赖的package包/类
public static boolean isImmutableIgnoreTests(Class<? extends AbstractEntity> beanClass)
{
	return  beanClass.getAnnotation(Immutable.class) != null && beanClass.getAnnotation(IgnoreImmutabilityTest.class) != null;
}
 
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:5,代码来源:ModelIntrospectionUtil.java


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