Git Product home page Git Product logo

Comments (6)

sockeqwe avatar sockeqwe commented on September 26, 2024 1

Hi,
nothing from the public API like @Path has been deprecated.

This GitHub issue is only about internal code generation and that there could be some optimizations done. I.e. NestedChildElementBinder is generated at compile time, but the generated code could be optimized further ...

from tikxml.

iNoles avatar iNoles commented on September 26, 2024

I have a question for

TypeSpec.anonymousClassBuilder("false")
                .addSuperinterface(nestedChildElementBinderType)
                .addInitializerBlock(initializerBuilder.build())
                .build()

in CodeGeneratorHelper.kt

Should I remove this

addSuperinterface(nestedChildElementBinderType)

line or replace with another variables

from tikxml.

sockeqwe avatar sockeqwe commented on September 26, 2024

I have no clue 😄 I have to look at the code in more detail,
but basically DelegatingTypeAdapter and NestedChildElementBinder should not be used anymore by the generated code and therefore these classes could be removed.

from tikxml.

iNoles avatar iNoles commented on September 26, 2024

here is code in question

fun generateNestedChildElementBinder(element: XmlElement): TypeSpec {

        val initializerBuilder = CodeBlock.builder()
        if (element.hasAttributes()) {
            val attributeMapType = ParameterizedTypeName.get(ClassName.get(HashMap::class.java), ClassName.get(String::class.java), attributeBinderType)
            initializerBuilder.addStatement("$attributeBindersParam = new \$T()", attributeMapType);
            initializerBuilder.add(generateAttributeBinders(element))
        }

        if (element.hasChildElements()) {
            val childBinderTypeMap = ParameterizedTypeName.get(ClassName.get(HashMap::class.java), ClassName.get(String::class.java), childElementBinderType)
            initializerBuilder.addStatement("$childElementBindersParam = new \$T()", childBinderTypeMap);
            for ((xmlName, xmlElement) in element.childElements) {
                initializerBuilder.addStatement("${CodeGeneratorHelper.childElementBindersParam}.put(\$S, \$L)", xmlName, xmlElement.generateReadXmlCode(this))
            }
        }


        // TODO text content?
        return TypeSpec.anonymousClassBuilder("false")
                .addSuperinterface(nestedChildElementBinderType)
                .addInitializerBlock(initializerBuilder.build())
                .build()
    }

from tikxml.

sockeqwe avatar sockeqwe commented on September 26, 2024

Sorry,
I haven't had time to look into this. Not sure if I have time the next 2 weeks.

from tikxml.

lukechi1219 avatar lukechi1219 commented on September 26, 2024

Hi @sockeqwe ,

I'm using 'com.tickaroo.tikxml:core:0.8.13' & 'com.tickaroo.tikxml:auto-value-tikxml:0.8.13'

and I got auto generated class GetCMSXmlTikXmlValueHolder$$TypeAdapter which has NestedChildElementBinder.

if NestedChildElementBinder is deprecated, does that mean I should not use @'Path' annotation?

public class GetCMSXmlTikXmlValueHolder$$TypeAdapter implements TypeAdapter<GetCMSXmlTikXmlValueHolder> {

....childElementBinders.put("cms:CmsDataSet", new NestedChildElementBinder<GetCMSXmlTikXmlValueHolder>(false) {
....}
}

-- xml pojo --

@Xml(name = "cms:ExchangeData")
@AutoValue
public abstract class GetCMSXml implements Parcelable {

    @Path("cms:CmsDataSet")
    @Element(name = "cms:CmsData")
    public abstract List<CmsData> cmsDataList();
}

from tikxml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.