/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
public AccessType getDefaultAccess() throws MappingException { AccessType accessType = defaultAccess; AccessType hibernateAccessType = AccessType.DEFAULT; AccessType jpaAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessTypeAnnotation = property.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessTypeAnnotation != null ) { hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); } Access access = property.getAnnotation( Access.class ); if ( access != null ) { jpaAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateAccessType != AccessType.DEFAULT && jpaAccessType != AccessType.DEFAULT && hibernateAccessType != jpaAccessType ) { StringBuilder builder = new StringBuilder(); builder.append( property.toString() ); builder.append( " defines @AccessType and @Access with contradicting values. Use of @Access only is recommended." ); throw new MappingException( builder.toString() ); } if ( hibernateAccessType != AccessType.DEFAULT ) { accessType = hibernateAccessType; } else if ( jpaAccessType != AccessType.DEFAULT ) { accessType = jpaAccessType; } return accessType; }
hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); jpaAccessType = AccessType.getAccessStrategy( access.value() );
private AccessType determineLocalClassDefinedAccessStrategy() { AccessType classDefinedAccessType; AccessType hibernateDefinedAccessType = AccessType.DEFAULT; AccessType jpaDefinedAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessType = xClass.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessType != null ) { hibernateDefinedAccessType = AccessType.getAccessStrategy( accessType.value() ); } Access access = xClass.getAnnotation( Access.class ); if ( access != null ) { jpaDefinedAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT && jpaDefinedAccessType != AccessType.DEFAULT && hibernateDefinedAccessType != jpaDefinedAccessType ) { throw new MappingException( "@AccessType and @Access specified with contradicting values. Use of @Access only is recommended. " ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT ) { classDefinedAccessType = hibernateDefinedAccessType; } else { classDefinedAccessType = jpaDefinedAccessType; } return classDefinedAccessType; }
/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
private AccessType determineDefaultAccessType() { for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) { if ( ( xclass.getSuperclass() == null || Object.class.getName().equals( xclass.getSuperclass().getName() ) ) && ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) && xclass.isAnnotationPresent( Access.class ) ) { return AccessType.getAccessStrategy( xclass.getAnnotation( Access.class ).value() ); } } // Guess from identifier. // FIX: Shouldn't this be determined by the first attribute (i.e., field or property) with annotations, but without an // explicit Access annotation, according to JPA 2.0 spec 2.3.1: Default Access Type? for (XClass xclass = clazz; xclass != null && !Object.class.getName().equals(xclass.getName()); xclass = xclass.getSuperclass()) { if ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) { for ( XProperty prop : xclass.getDeclaredProperties( AccessType.PROPERTY.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.PROPERTY; } } for ( XProperty prop : xclass.getDeclaredProperties( AccessType.FIELD.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.FIELD; } } } } throw new AnnotationException( "No identifier specified for entity: " + clazz ); }
public AccessType getDefaultAccess() throws MappingException { AccessType accessType = defaultAccess; AccessType hibernateAccessType = AccessType.DEFAULT; AccessType jpaAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessTypeAnnotation = property.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessTypeAnnotation != null ) { hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); } Access access = property.getAnnotation( Access.class ); if ( access != null ) { jpaAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateAccessType != AccessType.DEFAULT && jpaAccessType != AccessType.DEFAULT && hibernateAccessType != jpaAccessType ) { StringBuilder builder = new StringBuilder(); builder.append( property.toString() ); builder.append( " defines @AccessType and @Access with contradicting values. Use of @Access only is recommended." ); throw new MappingException( builder.toString() ); } if ( hibernateAccessType != AccessType.DEFAULT ) { accessType = hibernateAccessType; } else if ( jpaAccessType != AccessType.DEFAULT ) { accessType = jpaAccessType; } return accessType; }
AccessType accessType = AccessType.getAccessStrategy( access.value() ); if ( accessType == AccessType.PROPERTY ) { log.warn( "Placing @Access(AccessType.PROPERTY) on a field does not have any effect." ); AccessType accessType = AccessType.getAccessStrategy( access.value() ); if ( accessType == AccessType.FIELD ) { log.warn( "Placing @Access(AccessType.FIELD) on a field does not have any effect." );
hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); jpaAccessType = AccessType.getAccessStrategy( access.value() );
private AccessType determineClassDefinedAccessStrategy() { AccessType classDefinedAccessType; AccessType hibernateDefinedAccessType = AccessType.DEFAULT; AccessType jpaDefinedAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessType = xClass.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessType != null ) { hibernateDefinedAccessType = AccessType.getAccessStrategy( accessType.value() ); } Access access = xClass.getAnnotation( Access.class ); if ( access != null ) { jpaDefinedAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT && jpaDefinedAccessType != AccessType.DEFAULT && hibernateDefinedAccessType != jpaDefinedAccessType ) { throw new MappingException( "@AccessType and @Access specified with contradicting values. Use of @Access only is recommended. " ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT ) { classDefinedAccessType = hibernateDefinedAccessType; } else { classDefinedAccessType = jpaDefinedAccessType; } return classDefinedAccessType; }
/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
/** * Take the annoted element for lazy process */ public PropertyInferredData(XClass declaringClass, XProperty property, String propertyAccessor, ReflectionManager reflectionManager) { this.declaringClass = declaringClass; this.property = property; this.defaultAccess = AccessType.getAccessStrategy( propertyAccessor ); this.reflectionManager = reflectionManager; }
public AccessType getDefaultAccess() throws MappingException { AccessType accessType = defaultAccess; AccessType hibernateAccessType = AccessType.DEFAULT; AccessType jpaAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessTypeAnnotation = property.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessTypeAnnotation != null ) { hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); } Access access = property.getAnnotation( Access.class ); if ( access != null ) { jpaAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateAccessType != AccessType.DEFAULT && jpaAccessType != AccessType.DEFAULT && hibernateAccessType != jpaAccessType ) { StringBuilder builder = new StringBuilder(); builder.append( property.toString() ); builder.append( " defines @AccessType and @Access with contradicting values. Use of @Access only is recommended." ); throw new MappingException( builder.toString() ); } if ( hibernateAccessType != AccessType.DEFAULT ) { accessType = hibernateAccessType; } else if ( jpaAccessType != AccessType.DEFAULT ) { accessType = jpaAccessType; } return accessType; }
public AccessType getDefaultAccess() throws MappingException { AccessType accessType = defaultAccess; AccessType hibernateAccessType = AccessType.DEFAULT; AccessType jpaAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessTypeAnnotation = property.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessTypeAnnotation != null ) { hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); } Access access = property.getAnnotation( Access.class ); if ( access != null ) { jpaAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateAccessType != AccessType.DEFAULT && jpaAccessType != AccessType.DEFAULT && hibernateAccessType != jpaAccessType ) { StringBuilder builder = new StringBuilder(); builder.append( property.toString() ); builder.append( " defines @AccessType and @Access with contradicting values. Use of @Access only is recommended." ); throw new MappingException( builder.toString() ); } if ( hibernateAccessType != AccessType.DEFAULT ) { accessType = hibernateAccessType; } else if ( jpaAccessType != AccessType.DEFAULT ) { accessType = jpaAccessType; } return accessType; }
hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); jpaAccessType = AccessType.getAccessStrategy( access.value() );
hibernateAccessType = AccessType.getAccessStrategy( accessTypeAnnotation.value() ); jpaAccessType = AccessType.getAccessStrategy( access.value() );
private AccessType determineClassDefinedAccessStrategy() { AccessType classDefinedAccessType; AccessType hibernateDefinedAccessType = AccessType.DEFAULT; AccessType jpaDefinedAccessType = AccessType.DEFAULT; org.hibernate.annotations.AccessType accessType = xClass.getAnnotation( org.hibernate.annotations.AccessType.class ); if ( accessType != null ) { hibernateDefinedAccessType = AccessType.getAccessStrategy( accessType.value() ); } Access access = xClass.getAnnotation( Access.class ); if ( access != null ) { jpaDefinedAccessType = AccessType.getAccessStrategy( access.value() ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT && jpaDefinedAccessType != AccessType.DEFAULT && hibernateDefinedAccessType != jpaDefinedAccessType ) { throw new MappingException( "@AccessType and @Access specified with contradicting values. Use of @Access only is recommended. " ); } if ( hibernateDefinedAccessType != AccessType.DEFAULT ) { classDefinedAccessType = hibernateDefinedAccessType; } else { classDefinedAccessType = jpaDefinedAccessType; } return classDefinedAccessType; }
private AccessType determineDefaultAccessType() { for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) { if ( ( xclass.getSuperclass() == null || Object.class.getName().equals( xclass.getSuperclass().getName() ) ) && ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) && xclass.isAnnotationPresent( Access.class ) ) { return AccessType.getAccessStrategy( xclass.getAnnotation( Access.class ).value() ); } } // Guess from identifier. // FIX: Shouldn't this be determined by the first attribute (i.e., field or property) with annotations, but without an // explicit Access annotation, according to JPA 2.0 spec 2.3.1: Default Access Type? for (XClass xclass = clazz; xclass != null && !Object.class.getName().equals(xclass.getName()); xclass = xclass.getSuperclass()) { if ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) { for ( XProperty prop : xclass.getDeclaredProperties( AccessType.PROPERTY.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.PROPERTY; } } for ( XProperty prop : xclass.getDeclaredProperties( AccessType.FIELD.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.FIELD; } } } } throw new AnnotationException( "No identifier specified for entity: " + clazz ); }
private AccessType determineDefaultAccessType() { for (XClass xclass = clazz; xclass != null; xclass = xclass.getSuperclass()) { if ((xclass.getSuperclass() == null || Object.class.getName().equals(xclass.getSuperclass().getName())) && (xclass.isAnnotationPresent(Entity.class) || xclass.isAnnotationPresent(MappedSuperclass.class)) && xclass.isAnnotationPresent(Access.class)) return AccessType.getAccessStrategy(xclass.getAnnotation(Access.class).value()); } // Guess from identifier. // FIX: Shouldn't this be determined by the first attribute (i.e., field or property) with annotations, but without an // explicit Access annotation, according to JPA 2.0 spec 2.3.1: Default Access Type? for (XClass xclass = clazz; xclass != null && !Object.class.getName().equals(xclass.getName()); xclass = xclass.getSuperclass()) { if ( xclass.isAnnotationPresent( Entity.class ) || xclass.isAnnotationPresent( MappedSuperclass.class ) ) { for ( XProperty prop : xclass.getDeclaredProperties( AccessType.PROPERTY.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.PROPERTY; } } for ( XProperty prop : xclass.getDeclaredProperties( AccessType.FIELD.getType() ) ) { final boolean isEmbeddedId = prop.isAnnotationPresent( EmbeddedId.class ); if ( prop.isAnnotationPresent( Id.class ) || isEmbeddedId ) { return AccessType.FIELD; } } } } throw new AnnotationException( "No identifier specified for entity: " + clazz ); }