class AbstractContractFactoryBean implements InitializingBean, FactoryBean,
                                                 ApplicationContextAware {
    /** bean id */
    protected String                  beanId;
    /** unique id */
    protected String                  uniqueId;
    /** interface class name */
    protected String                  interfaceType;
    /** interface class type */
    protected Class<?>                interfaceClass;

    /** sofa runtime context */
    protected SofaRuntimeContext      sofaRuntimeContext;
    /** xml elements */
    protected List<TypedStringValue>  elements;
    /** spring context */
    protected ApplicationContext      applicationContext;
    /** bindings */
    protected List<Binding>           bindings = new ArrayList<>(2);
    /** document encoding */
    protected String                  documentEncoding;
    /** repeat times */
    protected String                  repeatReferLimit;
    /** binding converter factory */
    protected BindingConverterFactory bindingConverterFactory;
    /** binding adapter factory */
    protected BindingAdapterFactory   bindingAdapterFactory;
    /** way to create factory bean. api or xml*/
    protected boolean                 apiType;

    @Override
    public void afterPropertiesSet() throws Exception {<FILL_FUNCTION_BODY>}

    protected List<Binding> parseBindings(List<Element> parseElements,
                                          ApplicationContext appContext, boolean isInBinding) {
        List<Binding> result = new ArrayList<>();

        if (parseElements != null) {
            for (Element element : parseElements) {
                String tagName = element.getLocalName();
                BindingConverter bindingConverter = bindingConverterFactory
                    .getBindingConverterByTagName(tagName);

                if (bindingConverter == null) {
                    dealWithbindingConverterNotExist(tagName);
                    continue;
                }

                BindingConverterContext bindingConverterContext = new BindingConverterContext();
                bindingConverterContext.setInBinding(isInBinding);
                bindingConverterContext.setApplicationContext(appContext);
                bindingConverterContext.setAppName(sofaRuntimeContext.getAppName());
                bindingConverterContext.setAppClassLoader(sofaRuntimeContext.getAppClassLoader());
                bindingConverterContext.setRepeatReferLimit(repeatReferLimit);
                bindingConverterContext.setBeanId(beanId);

                setProperties(bindingConverterContext);

                Binding binding = bindingConverter.convert(element, bindingConverterContext);

                result.add(binding);
            }
        }

        return result;
    }

    protected void dealWithbindingConverterNotExist(String tagName) {
        throw new ServiceRuntimeException(ErrorCode.convert("01-00200", tagName));
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public Class<?> getInterfaceClass() {
        if (interfaceClass == null) {
            try {
                interfaceClass = Thread.currentThread().getContextClassLoader()
                    .loadClass(interfaceType);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            } catch (NullPointerException e) {
                // No type found for shortcut FactoryBean instance:
                // fall back to full creation of the FactoryBean instance
                return null;
            }
        }

        return interfaceClass;
    }

    public void setInterfaceClass(Class interfaceType) {
        this.interfaceClass = interfaceType;
    }

    public List<Binding> getBindings() {
        return bindings;
    }

    public void setBindings(List<Binding> bindings) {
        this.bindings = bindings;
    }

    public void setUniqueId(String uniqueId) {
        this.uniqueId = uniqueId;
    }

    public String getUniqueId() {
        return uniqueId;
    }

    public void setInterfaceType(String interfaceType) {
        this.interfaceType = interfaceType;
    }

    public String getInterfaceType() {
        return this.interfaceType;
    }

    public void setElements(List<TypedStringValue> elements) {
        this.elements = elements;
    }

    public void setDocumentEncoding(String documentEncoding) {
        this.documentEncoding = documentEncoding;
    }

    public void setRepeatReferLimit(String repeatReferLimit) {
        this.repeatReferLimit = repeatReferLimit;
    }

    public String getBeanId() {
        return beanId;
    }

    public void setBeanId(String beanId) {
        this.beanId = beanId;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public boolean isApiType() {
        return apiType;
    }

    public void setApiType(boolean apiType) {
        this.apiType = apiType;
    }

    public void setSofaRuntimeContext(SofaRuntimeContext sofaRuntimeContext) {
        this.sofaRuntimeContext = sofaRuntimeContext;
    }

    public void setBindingConverterFactory(BindingConverterFactory bindingConverterFactory) {
        this.bindingConverterFactory = bindingConverterFactory;
    }

    public void setBindingAdapterFactory(BindingAdapterFactory bindingAdapterFactory) {
        this.bindingAdapterFactory = bindingAdapterFactory;
    }

    /**
     * Is in binding or not.
     *
     * @return true or false
     */
    protected abstract boolean isInBinding();

    /**
     * Set properties to bindingConverterContext.
     *
     * @param bindingConverterContext bindingConverterContext
     */
    protected abstract void setProperties(BindingConverterContext bindingConverterContext);
}

        List<Element> tempElements = new ArrayList<>();
        if (elements != null) {
            for (TypedStringValue element : elements) {
                DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
                    .newInstance();
                documentBuilderFactory.setNamespaceAware(true);
                InputSource inputSource;
                if (documentEncoding != null) {
                    inputSource = new InputSource(new ByteArrayInputStream(element.getValue()
                        .getBytes(documentEncoding)));
                } else {
                    inputSource = new InputSource(new ByteArrayInputStream(element.getValue()
                        .getBytes()));
                }
                inputSource.setEncoding(documentEncoding);
                Element node = documentBuilderFactory.newDocumentBuilder().parse(inputSource)
                    .getDocumentElement();
                tempElements.add(node);
            }
        }
        if (!apiType) {
            this.bindings = parseBindings(tempElements, applicationContext, isInBinding());
        }
    
<no_super_class>