org.hibernate.annotations.TypeDef Java Examples
The following examples show how to use
org.hibernate.annotations.TypeDef.
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: AnnotationBinder.java From lams with GNU General Public License v2.0 | 5 votes |
private static void bindTypeDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) { TypeDef defAnn = annotatedElement.getAnnotation( TypeDef.class ); TypeDefs defsAnn = annotatedElement.getAnnotation( TypeDefs.class ); if ( defAnn != null ) { bindTypeDef( defAnn, context ); } if ( defsAnn != null ) { for ( TypeDef def : defsAnn.value() ) { bindTypeDef( def, context ); } } }
Example #2
Source File: AnnotationBinder.java From lams with GNU General Public License v2.0 | 4 votes |
private static void bindTypeDef(TypeDef defAnn, MetadataBuildingContext context) { Properties params = new Properties(); for ( Parameter param : defAnn.parameters() ) { params.setProperty( param.name(), param.value() ); } if ( BinderHelper.isEmptyAnnotationValue( defAnn.name() ) && defAnn.defaultForType().equals( void.class ) ) { throw new AnnotationException( "Either name or defaultForType (or both) attribute should be set in TypeDef having typeClass " + defAnn.typeClass().getName() ); } final String typeBindMessageF = "Binding type definition: %s"; if ( !BinderHelper.isEmptyAnnotationValue( defAnn.name() ) ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( typeBindMessageF, defAnn.name() ); } context.getMetadataCollector().addTypeDefinition( new TypeDefinition( defAnn.name(), defAnn.typeClass(), null, params ) ); } if ( !defAnn.defaultForType().equals( void.class ) ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( typeBindMessageF, defAnn.defaultForType().getName() ); } context.getMetadataCollector().addTypeDefinition( new TypeDefinition( defAnn.defaultForType().getName(), defAnn.typeClass(), new String[]{ defAnn.defaultForType().getName() }, params ) ); } }