@Override public <T> Class<T> classForName(String name) { return getDelegate().classForName( name ); }
private void checkForOrphanProperties(Element tree) { Class clazz; try { clazz = classLoaderAccess.classForName( className );
@SuppressWarnings("unchecked") private void setLocalAttributeConverterDefinitions(List<Element> converterElements) { for ( Element converterElement : converterElements ) { final String className = converterElement.attributeValue( "class" ); final String autoApplyAttribute = converterElement.attributeValue( "auto-apply" ); final boolean autoApply = autoApplyAttribute != null && Boolean.parseBoolean( autoApplyAttribute ); try { final Class<? extends AttributeConverter> attributeConverterClass = classLoaderAccess.classForName( className ); attributeConverterInfoList.add( new AttributeConverterDefinition( attributeConverterClass.newInstance(), autoApply ) ); } catch (ClassLoadingException e) { throw new AnnotationException( "Unable to locate specified AttributeConverter implementation class : " + className, e ); } catch (Exception e) { throw new AnnotationException( "Unable to instantiate specified AttributeConverter implementation class : " + className, e ); } } }
if ( cleanedGroupName.length() > 0) { try { groupsList.add( classLoaderAccess.classForName( cleanedGroupName ) );
/** * Construct an instance of the given tuplizer class. * * @param tuplizerClassName The name of the tuplizer class to instantiate * @param metadata The metadata for the component. * * @return The instantiated tuplizer * * @throws HibernateException If class name cannot be resolved to a class reference, or if the * {@link Constructor#newInstance} call fails. */ @SuppressWarnings({ "unchecked" }) public ComponentTuplizer constructTuplizer(String tuplizerClassName, Component metadata) { try { Class<? extends ComponentTuplizer> tuplizerClass = classLoaderAccess.classForName( tuplizerClassName ); return constructTuplizer( tuplizerClass, metadata ); } catch ( ClassLoadingException e ) { throw new HibernateException( "Could not locate specified tuplizer class [" + tuplizerClassName + "]" ); } }
public static Class reflectedPropertyClass( MetadataBuildingContext buildingContext, String attributeOwnerClassName, String attributeName) { final Class attributeOwnerClass = buildingContext.getBootstrapContext().getClassLoaderAccess().classForName( attributeOwnerClassName ); return reflectedPropertyClass( buildingContext, attributeOwnerClass, attributeName ); }
public Class getMappedClass() throws MappingException { if ( className == null ) { return null; } try { if ( mappedClass == null ) { mappedClass = metadataBuildingContext.getBootstrapContext().getClassLoaderAccess().classForName( className ); } return mappedClass; } catch (ClassLoadingException e) { throw new MappingException( "entity class not found: " + className, e ); } }
scannerImplClass = classLoaderAccess.classForName( scannerSetting.toString() );
public Class getProxyInterface() { if ( proxyInterfaceName == null ) { return null; } try { if ( proxyInterface == null ) { proxyInterface = metadataBuildingContext.getBootstrapContext().getClassLoaderAccess().classForName( proxyInterfaceName ); } return proxyInterface; } catch (ClassLoadingException e) { throw new MappingException( "proxy class not found: " + proxyInterfaceName, e ); } }
private static Class resolveClassReference( String className, XMLContext.Default defaults, ClassLoaderAccess classLoaderAccess) { if ( className == null ) { throw new AnnotationException( "<entity-result> without entity-class. " + SCHEMA_VALIDATION ); } try { return classLoaderAccess.classForName( XMLContext.buildSafeClassName( className, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find specified class: " + 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 = classLoaderAccess.classForName( XMLContext.buildSafeClassName( className, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find " + element.getPath() + " " + nodeName + ": " + className, e ); } ad.setValue( getJavaAttributeNameFromXMLOne( nodeName ), clazz ); } }
private EntityListeners getEntityListeners(Element tree, XMLContext.Default defaults) { Element element = tree != null ? tree.element( "entity-listeners" ) : null; if ( element != null ) { List<Class> entityListenerClasses = new ArrayList<>(); for ( Element subelement : (List<Element>) element.elements( "entity-listener" ) ) { String className = subelement.attributeValue( "class" ); try { entityListenerClasses.add( classLoaderAccess.classForName( XMLContext.buildSafeClassName( className, defaults ) ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find " + element.getPath() + ".class: " + className, e ); } } AnnotationDescriptor ad = new AnnotationDescriptor( EntityListeners.class ); ad.setValue( "value", entityListenerClasses.toArray( new Class[entityListenerClasses.size()] ) ); return AnnotationFactory.create( ad ); } else if ( defaults.canUseJavaAnnotations() ) { return getPhysicalAnnotation( EntityListeners.class ); } else { return null; } }
clazz = classLoaderAccess.classForName( className );
private static void bindNamedSubgraph( XMLContext.Default defaults, AnnotationDescriptor ann, List<Element> subgraphNodes, ClassLoaderAccess classLoaderAccess) { List<NamedSubgraph> annSubgraphNodes = new ArrayList<>( ); for(Element subgraphNode : subgraphNodes){ AnnotationDescriptor annSubgraphNode = new AnnotationDescriptor( NamedSubgraph.class ); copyStringAttribute( annSubgraphNode, subgraphNode, "name", true ); String clazzName = subgraphNode.attributeValue( "class" ); Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( clazzName, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find entity-class: " + clazzName, e ); } annSubgraphNode.setValue( "type", clazz ); bindNamedAttributeNodes(subgraphNode, annSubgraphNode); annSubgraphNodes.add( AnnotationFactory.create( annSubgraphNode ) ); } ann.setValue( "subgraphs", annSubgraphNodes.toArray( new NamedSubgraph[annSubgraphNodes.size()] ) ); }
private void getMapKeyClass(List<Annotation> annotationList, Element element, XMLContext.Default defaults) { String nodeName = "map-key-class"; Element subelement = element != null ? element.element( nodeName ) : null; if ( subelement != null ) { String mapKeyClassName = subelement.attributeValue( "class" ); AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyClass.class ); if ( StringHelper.isNotEmpty( mapKeyClassName ) ) { Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( mapKeyClassName, defaults ) ); } catch ( ClassLoadingException e ) { throw new AnnotationException( "Unable to find " + element.getPath() + " " + nodeName + ": " + mapKeyClassName, e ); } ad.setValue( "value", clazz ); } annotationList.add( AnnotationFactory.create( ad ) ); } }
Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( clazzName, defaults ) );
Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( clazzName, defaults ) ); Class clazz; try { clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( clazzName, defaults ) );
); try { final Class converterClass = classLoaderAccess.classForName( converterClassName ); convertAnnotationDescriptor.setValue( "converter", converterClass );
&& simpleValue.getMetadata().getTypeResolver().basic( simpleValue.getTypeName() ) == null ) { try { Class typeClass = buildingContext.getBootstrapContext().getClassLoaderAccess().classForName( simpleValue.getTypeName() );
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 = classLoaderAccess.classForName( XMLContext.buildSafeClassName( attr.getValue(), defaults ) ); } catch ( ClassLoadingException 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 getPhysicalAnnotation( IdClass.class ); } else { return null; } }