private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) { SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class ); IdentifierGeneratorDefinition idGen = buildIdGenerator( ann, context ); context.getMetadataCollector().addIdentifierGenerator( idGen ); if ( pckg.isAnnotationPresent( SequenceGenerators.class ) ) { SequenceGenerators ann = pckg.getAnnotation( SequenceGenerators.class ); for ( SequenceGenerator tableGenerator : ann.value() ) { context.getMetadataCollector().addIdentifierGenerator( buildIdGenerator( tableGenerator, context ) ); if ( pckg.isAnnotationPresent( TableGenerator.class ) ) { TableGenerator ann = pckg.getAnnotation( TableGenerator.class ); IdentifierGeneratorDefinition idGen = buildIdGenerator( ann, context ); context.getMetadataCollector().addIdentifierGenerator( idGen ); if ( pckg.isAnnotationPresent( TableGenerators.class ) ) { TableGenerators ann = pckg.getAnnotation( TableGenerators.class ); for ( TableGenerator tableGenerator : ann.value() ) { context.getMetadataCollector().addIdentifierGenerator( buildIdGenerator( tableGenerator, context ) );
public static void bindPackage(String packageName, ExtendedMappings mappings) { XPackage pckg; try { pckg = mappings.getReflectionManager().packageForName( packageName ); } catch ( ClassNotFoundException cnf ) { log.warn( "Package not found or wo package-info.java: {}", packageName ); return; } if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) { SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); log.trace( "Add sequence generator with name: {}", idGen.getName() ); } if ( pckg.isAnnotationPresent( TableGenerator.class ) ) { TableGenerator ann = pckg.getAnnotation( TableGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); } bindGenericGenerators( pckg, mappings ); bindQueries( pckg, mappings ); bindFilterDefs( pckg, mappings ); bindTypeDefs( pckg, mappings ); bindFetchProfiles( pckg, mappings ); BinderHelper.bindAnyMetaDefs( pckg, mappings ); }
private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isDefault( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
public static void bindPackage(String packageName, Mappings mappings) { XPackage pckg; try { pckg = mappings.getReflectionManager().packageForName( packageName ); } catch ( ClassNotFoundException cnf ) { LOG.packageNotFound( packageName ); return; } if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) { SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Add sequence generator with name: {0}", idGen.getName() ); } } if ( pckg.isAnnotationPresent( TableGenerator.class ) ) { TableGenerator ann = pckg.getAnnotation( TableGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); } bindGenericGenerators( pckg, mappings ); bindQueries( pckg, mappings ); bindFilterDefs( pckg, mappings ); bindTypeDefs( pckg, mappings ); bindFetchProfiles( pckg, mappings ); BinderHelper.bindAnyMetaDefs( pckg, mappings ); }
private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
public static void bindPackage(String packageName, Mappings mappings) { XPackage pckg; try { pckg = mappings.getReflectionManager().packageForName( packageName ); } catch ( ClassNotFoundException cnf ) { LOG.packageNotFound( packageName ); return; } if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) { SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Add sequence generator with name: {0}", idGen.getName() ); } } if ( pckg.isAnnotationPresent( TableGenerator.class ) ) { TableGenerator ann = pckg.getAnnotation( TableGenerator.class ); IdGenerator idGen = buildIdGenerator( ann, mappings ); mappings.addGenerator( idGen ); } bindGenericGenerators( pckg, mappings ); bindQueries( pckg, mappings ); bindFilterDefs( pckg, mappings ); bindTypeDefs( pckg, mappings ); bindFetchProfiles( pckg, mappings ); BinderHelper.bindAnyMetaDefs( pckg, mappings ); }
private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) { SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class ); IdentifierGeneratorDefinition idGen = buildIdGenerator( ann, context ); context.getMetadataCollector().addIdentifierGenerator( idGen ); if ( pckg.isAnnotationPresent( SequenceGenerators.class ) ) { SequenceGenerators ann = pckg.getAnnotation( SequenceGenerators.class ); for ( SequenceGenerator tableGenerator : ann.value() ) { context.getMetadataCollector().addIdentifierGenerator( buildIdGenerator( tableGenerator, context ) ); if ( pckg.isAnnotationPresent( TableGenerator.class ) ) { TableGenerator ann = pckg.getAnnotation( TableGenerator.class ); IdentifierGeneratorDefinition idGen = buildIdGenerator( ann, context ); context.getMetadataCollector().addIdentifierGenerator( idGen ); if ( pckg.isAnnotationPresent( TableGenerators.class ) ) { TableGenerators ann = pckg.getAnnotation( TableGenerators.class ); for ( TableGenerator tableGenerator : ann.value() ) { context.getMetadataCollector().addIdentifierGenerator( buildIdGenerator( tableGenerator, context ) );
private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
/** * @param annotatedElement an annotated element * * @return a string which identifies the location/point the annotation was placed on. Something of the * form package.[[className].[field|member]] */ private String buildAnnotationDefinitionPoint(XAnnotatedElement annotatedElement) { if ( annotatedElement instanceof XClass ) { return ( (XClass) annotatedElement ).getName(); } else if ( annotatedElement instanceof XMember ) { XMember member = (XMember) annotatedElement; return member.getType().getName() + '.' + member.getName(); } else if ( annotatedElement instanceof XPackage ) { return ( (XPackage) annotatedElement ).getName(); } else { throw new SearchException( "Unknown XAnnotatedElement: " + annotatedElement ); } }
/** * @param annotatedElement an annotated element * * @return a string which identifies the location/point the annotation was placed on. Something of the * form package.[[className].[field|member]] */ private String buildAnnotationDefinitionPoint(XAnnotatedElement annotatedElement) { if ( annotatedElement instanceof XClass ) { return ( (XClass) annotatedElement ).getName(); } else if ( annotatedElement instanceof XMember ) { XMember member = (XMember) annotatedElement; return member.getType().getName() + '.' + member.getName(); } else if ( annotatedElement instanceof XPackage ) { return ( (XPackage) annotatedElement ).getName(); } else { throw new SearchException( "Unknown XAnnotatedElement: " + annotatedElement ); } }