All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rahulsom.svg.Context.groovy Maven / Gradle / Ivy

package com.github.rahulsom.svg

import groovy.transform.CompileStatic

import javax.xml.bind.JAXBElement

@CompileStatic
class Context {
    List things = new ArrayList<>();

    boolean leftShift(Object object) {

        if (object instanceof JAXBElement) {
            things.add(object)
        } else {

            def factory = new ObjectFactory()
            def method = factory.metaClass.methods.find {
                it.returnType == JAXBElement &&
                        it.parameterTypes.length == 1 &&
                        it.parameterTypes[0].isAssignableFrom(object.class) &&
                        it.parameterTypes[0].name != 'java.lang.Object'
            }

            println method
            things.add(method.invoke(factory, [object] as Object[]) as JAXBElement)
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy