Java 类javax.persistence.NamedSubgraph 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
private static void bindNamedSubgraph(XMLContext.Default defaults, AnnotationDescriptor ann, List<Element> subgraphNodes) {
    List<NamedSubgraph> annSubgraphNodes = new ArrayList<NamedSubgraph>(  );
    for(Element subgraphNode : subgraphNodes){
        AnnotationDescriptor annSubgraphNode = new AnnotationDescriptor( NamedSubgraph.class );
        copyStringAttribute( annSubgraphNode, subgraphNode, "name", true );
        String clazzName = subgraphNode.attributeValue( "class" );
        Class clazz;
        try {
            clazz = ReflectHelper.classForName(
                    XMLContext.buildSafeClassName( clazzName, defaults ),
                    JPAOverriddenAnnotationReader.class
            );
        }
        catch ( ClassNotFoundException e ) {
            throw new AnnotationException( "Unable to find entity-class: " + clazzName, e );
        }
        annSubgraphNode.setValue( "type", clazz );
        bindNamedAttributeNodes(subgraphNode, annSubgraphNode);
        annSubgraphNodes.add( (NamedSubgraph) AnnotationFactory.create( annSubgraphNode ) );
    }
    ann.setValue( "subgraphs", annSubgraphNodes.toArray( new NamedSubgraph[annSubgraphNodes.size()] ) );
}