/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.PrintStream
 *  java.lang.Class
 *  java.lang.ClassLoader
 *  java.lang.ClassNotFoundException
 *  java.lang.Exception
 *  java.lang.NoClassDefFoundError
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.lang.System
 *  org.xml.sax.Attributes
 */
package org.dom4j.bean;

import java.io.PrintStream;
import org.dom4j.Attribute;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.dom4j.QName;
import org.dom4j.bean.BeanElement;
import org.dom4j.tree.DefaultAttribute;
import org.xml.sax.Attributes;

public class BeanDocumentFactory
extends DocumentFactory {
    static Class class$org$dom4j$bean$BeanDocumentFactory;
    private static BeanDocumentFactory singleton;

    static {
        singleton = new BeanDocumentFactory();
    }

    static Class class$(String string2) {
        try {
            Class class_ = Class.forName((String)string2);
            return class_;
        }
        catch (ClassNotFoundException var1_2) {
            throw new NoClassDefFoundError(var1_2.getMessage());
        }
    }

    public static DocumentFactory getInstance() {
        return singleton;
    }

    @Override
    public Attribute createAttribute(Element element, QName qName, String string2) {
        return new DefaultAttribute(qName, string2);
    }

    protected Object createBean(QName qName) {
        return null;
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    protected Object createBean(QName qName, Attributes attributes) {
        String string2 = attributes.getValue("class");
        if (string2 == null) return null;
        try {
            Class class_;
            if (class$org$dom4j$bean$BeanDocumentFactory == null) {
                class$org$dom4j$bean$BeanDocumentFactory = class_ = BeanDocumentFactory.class$("org.dom4j.bean.BeanDocumentFactory");
                do {
                    return Class.forName((String)string2, (boolean)true, (ClassLoader)class_.getClassLoader()).newInstance();
                    break;
                } while (true);
            }
            class_ = class$org$dom4j$bean$BeanDocumentFactory;
            return Class.forName((String)string2, (boolean)true, (ClassLoader)class_.getClassLoader()).newInstance();
        }
        catch (Exception var4_5) {
            this.handleException(var4_5);
        }
        return null;
    }

    @Override
    public Element createElement(QName qName) {
        Object object = this.createBean(qName);
        if (object == null) {
            return new BeanElement(qName);
        }
        return new BeanElement(qName, object);
    }

    public Element createElement(QName qName, Attributes attributes) {
        Object object = this.createBean(qName, attributes);
        if (object == null) {
            return new BeanElement(qName);
        }
        return new BeanElement(qName, object);
    }

    protected void handleException(Exception exception) {
        System.out.println(new StringBuffer().append("#### Warning: couldn't create bean: ").append((Object)exception).toString());
    }
}

