/** * Tries to load Hibernate Search event listener. * * @return An event listener instance in case the jar was available. */ private static Class<?> attemptToLoadSearchEventListener() { Class searchEventListenerClass = null; try { searchEventListenerClass = ReflectHelper.classForName( FULL_TEXT_INDEX_EVENT_LISTENER_CLASS, HibernateSearchEventListenerRegister.class); } catch (ClassNotFoundException e) { log.debug("Search not present in classpath, ignoring event listener registration."); } return searchEventListenerClass; }
public void setParameterValues(Properties parameters) { String enumClassName = parameters.getProperty( ENUM ); try { enumClass = ReflectHelper.classForName( enumClassName, this.getClass() ).asSubclass( Enum.class ); } catch (ClassNotFoundException exception) { throw new HibernateException( "Enum class not found", exception ); } // is might be good to call it here, to see a possible error immediately // initEnumValue(); //nullify unnullified properties yuck! schema = parameters.getProperty( SCHEMA ); if ( "".equals( schema ) ) schema = null; catalog = parameters.getProperty( CATALOG ); if ( "".equals( catalog ) ) catalog = null; // table = parameters.getProperty( TABLE ); // column = parameters.getProperty( COLUMN ); String type = parameters.getProperty( TYPE ); if ( type != null ) { sqlType = Integer.decode( type ).intValue(); // guessed = true; } }
private void checkForOrphanProperties(Element tree) { Class clazz; try { clazz = ReflectHelper.classForName( className, this.getClass() );
Method applyMethod = null; try { Class classValidator = ReflectHelper.classForName( "org.hibernate.validator.ClassValidator", this.getClass() ); Class messageInterpolator = ReflectHelper.classForName( "org.hibernate.validator.MessageInterpolator", this.getClass() ); try { Object validator = validatorCtr.newInstance( ReflectHelper.classForName( className ), null, null, null, reflectionManager ); applyMethod.invoke( validator, persistentClazz );
searchStartupClass = ReflectHelper.classForName( SEARCH_STARTUP_CLASS, AnnotationConfiguration.class ); searchStartupClass = ReflectHelper.classForName( "org.hibernate.cfg.search.HibernateSearchEventListenerRegister", AnnotationConfiguration.class );
public void setParameterValues(Properties parameters) { if ( parameters != null ) { String className = parameters.getProperty( CLASS_NAME ); if ( className == null ) { throw new MappingException( "No class name defined for type: " + SerializableToBlobType.class.getName() ); } try { serializableClass = ReflectHelper.classForName( className ); } catch (ClassNotFoundException e) { throw new MappingException( "Unable to load class from " + CLASS_NAME + " parameter", e ); } } type = new SerializableType( serializableClass ); } }
if ( cleanedGroupName.length() > 0) { try { groupsList.add( ReflectHelper.classForName( cleanedGroupName ) );
try { ReflectHelper.classForName( BV_DISCOVERY_CLASS, BeanValidationActivator.class ); Class<?> activator = ReflectHelper.classForName( TYPE_SAFE_ACTIVATOR_CLASS, BeanValidationActivator.class ); Method applyDDL = activator.getMethod( TYPE_SAFE_DDL_METHOD, Collection.class, Properties.class );
ReflectHelper.classForName( BV_DISCOVERY_CLASS, BeanValidationActivator.class ); Class<?> activator = ReflectHelper.classForName( TYPE_SAFE_ACTIVATOR_CLASS, BeanValidationActivator.class ); Method activateBeanValidation = activator.getMethod( TYPE_SAFE_ACTIVATOR_METHOD, EventListeners.class, Properties.class );
for ( String className : xmlContext.getDefaultEntityListeners() ) { try { entityListeners.add( ReflectHelper.classForName( className, this.getClass() ) );
public static void applyDDL(Collection<PersistentClass> persistentClasses, Properties properties) { ValidatorFactory factory = getValidatorFactory( properties ); Class<?>[] groupsArray = new GroupsPerOperation( properties ).get( GroupsPerOperation.Operation.DDL ); Set<Class<?>> groups = new HashSet<Class<?>>( Arrays.asList( groupsArray ) ); for ( PersistentClass persistentClass : persistentClasses ) { final String className = persistentClass.getClassName(); if ( className == null || className.length() == 0) continue; Class<?> clazz; try { clazz = ReflectHelper.classForName( className, TypeSafeActivator.class ); } catch ( ClassNotFoundException e ) { throw new AssertionFailure( "Entity class not found", e); } try { applyDDL( "", persistentClass, clazz, factory, groups, true ); } catch (Exception e) { logger.warn( "Unable to apply constraints on DDL for " + className, e ); } } }
private void addTargetClass(Element element, AnnotationDescriptor ad, String nodeName, XMLContext.Default defaults) { String className = element.attributeValue( nodeName ); if ( className != null ) { Class clazz; try { clazz = ReflectHelper.classForName( XMLContext.buildSafeClassName( className, defaults ), this.getClass() ); } catch (ClassNotFoundException e) { throw new AnnotationException( "Unable to find " + element.getPath() + " " + nodeName + ": " + className, e ); } ad.setValue( getJavaAttributeNameFromXMLOne(nodeName), clazz ); } }
try { entityListenerClasses.add( ReflectHelper.classForName( XMLContext.buildSafeClassName( className, defaults ), this.getClass()
Class clazz; try { clazz = ReflectHelper.classForName( XMLContext.buildSafeClassName( clazzName, defaults ), JPAOverridenAnnotationReader.class
clazz = ReflectHelper.classForName( XMLContext.buildSafeClassName( clazzName, defaults ), JPAOverridenAnnotationReader.class Class clazz; try { clazz = ReflectHelper.classForName( XMLContext.buildSafeClassName( clazzName, defaults ), JPAOverridenAnnotationReader.class
Class validateEventListenerClass = null; try { validateEventListenerClass = ReflectHelper.classForName( "org.hibernate.validator.event.ValidateEventListener", AnnotationConfiguration.class
private IdClass getIdClass(Element tree, XMLContext.Default defaults) { Element element = tree == null ? null : tree.element( "id-class" ); if ( element != null ) { Attribute attr = element.attribute( "class" ); if ( attr != null ) { AnnotationDescriptor ad = new AnnotationDescriptor( IdClass.class ); Class clazz; try { clazz = ReflectHelper.classForName( XMLContext.buildSafeClassName( attr.getValue(), defaults ), this.getClass() ); } catch (ClassNotFoundException e) { throw new AnnotationException( "Unable to find id-class: " + attr.getValue(), e ); } ad.setValue( "value", clazz ); return AnnotationFactory.create( ad ); } else { throw new AnnotationException( "id-class without class. " + SCHEMA_VALIDATION ); } } else if ( defaults.canUseJavaAnnotations() ) { return getJavaAnnotation( IdClass.class ); } else { return null; } }
Class loadedClass; try { loadedClass = ReflectHelper.classForName( clazz.getValue() );
public static Class getIdentifierGeneratorClass(String strategy, Dialect dialect) { Class clazz = (Class) GENERATORS.get(strategy); if ( "native".equals(strategy) ) clazz = dialect.getNativeIdentifierGeneratorClass(); try { if (clazz==null) clazz = ReflectHelper.classForName(strategy); } catch (ClassNotFoundException e) { throw new MappingException("could not interpret id generator strategy: " + strategy); } return clazz; }
if ( entityAnn != null && !BinderHelper.isDefault( entityAnn.persister() ) ) { try { persister = ReflectHelper.classForName( entityAnn.persister() );