org.hibernate.annotations.Target Java Examples

The following examples show how to use org.hibernate.annotations.Target. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertyContainer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static boolean discoverTypeWithoutReflection(XProperty p) {
	if ( p.isAnnotationPresent( OneToOne.class ) && !p.getAnnotation( OneToOne.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( OneToMany.class ) && !p.getAnnotation( OneToMany.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToOne.class ) && !p.getAnnotation( ManyToOne.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToMany.class ) && !p.getAnnotation( ManyToMany.class )
			.targetEntity()
			.equals( void.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( org.hibernate.annotations.Any.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( ManyToAny.class ) ) {
		if ( !p.isCollection() && !p.isArray() ) {
			throw new AnnotationException( "@ManyToAny used on a non collection non array property: " + p.getName() );
		}
		return true;
	}
	else if ( p.isAnnotationPresent( Type.class ) ) {
		return true;
	}
	else if ( p.isAnnotationPresent( Target.class ) ) {
		return true;
	}
	return false;
}
 
Example #2
Source File: PropertyInferredData.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public XClass getPropertyClass() throws MappingException {
	if ( property.isAnnotationPresent( Target.class ) ) {
		return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() );
	}
	else {
		return property.getType();
	}
}
 
Example #3
Source File: PropertyInferredData.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public XClass getClassOrElement() throws MappingException {
	if ( property.isAnnotationPresent( Target.class ) ) {
		return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() );
	}
	else {
		return property.getClassOrElementClass();
	}
}