javax.persistence.FieldResult Java Examples

The following examples show how to use javax.persistence.FieldResult. 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: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private static EntityResult buildEntityResult(
		Element entityResultElement,
		XMLContext.Default defaults,
		ClassLoaderAccess classLoaderAccess) {
	final AnnotationDescriptor entityResultDescriptor = new AnnotationDescriptor( EntityResult.class );

	final Class entityClass = resolveClassReference( entityResultElement.attributeValue( "entity-class" ), defaults, classLoaderAccess );
	entityResultDescriptor.setValue( "entityClass", entityClass );

	copyStringAttribute( entityResultDescriptor, entityResultElement, "discriminator-column", false );

	// process the <field-result/> sub-elements
	List<FieldResult> fieldResultAnnotations = new ArrayList<>();
	for ( Element fieldResult : (List<Element>) entityResultElement.elements( "field-result" ) ) {
		AnnotationDescriptor fieldResultDescriptor = new AnnotationDescriptor( FieldResult.class );
		copyStringAttribute( fieldResultDescriptor, fieldResult, "name", true );
		copyStringAttribute( fieldResultDescriptor, fieldResult, "column", true );
		fieldResultAnnotations.add( AnnotationFactory.create( fieldResultDescriptor ) );
	}
	entityResultDescriptor.setValue(
			"fields", fieldResultAnnotations.toArray( new FieldResult[fieldResultAnnotations.size()] )
	);
	return AnnotationFactory.create( entityResultDescriptor );
}