Class WadlGeneratorLoader


  • class WadlGeneratorLoader
    extends java.lang.Object
    Loads WadlGenerators from a provided list of WadlGeneratorDescriptions.
    The properties of the WadlGeneratorDescriptions can refer to WadlGenerator properties of these types:
    • exact match: if the WadlGenerator property is of type org.example.Foo and the property value provided by the WadlGeneratorDescription is of type org.example.Foo
    • java.io.InputStream: The InputStream can e.g. represent a file. The stream is loaded from the property value (provided by the WadlGeneratorDescription) via ClassLoader.getResourceAsStream(String) or via OSGi API means if OSGi runtime is detected. The stream will be closed after WadlGenerator.init() was called.
    • Types that provide a constructor for the provided type (mostly java.lang.String)
    • Deprecated, will be removed in future versions from the WadlGeneratorLoader:
      java.lang.File: The property value can contain the prefix classpath: to denote, that the path to the file is relative to the classpath. In this case, the property value is stripped by the prefix classpath: and the java.lang.File is created via
      new File( generator.getClass().getResource( strippedFilename ).toURI() )
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
    • Constructor Detail

      • WadlGeneratorLoader

        WadlGeneratorLoader()
    • Method Detail

      • loadWadlGenerators

        static WadlGenerator loadWadlGenerators​(java.util.List<WadlGenerator> wadlGenerators)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setProperty

        private static WadlGeneratorLoader.Callback setProperty​(java.lang.Object generator,
                                                                java.lang.String propertyName,
                                                                java.lang.Object propertyValue,
                                                                java.lang.Class<?> osgiConfigClass)
                                                         throws java.lang.Exception
        Set the object (generator) property with the given name to the specified value.
        Parameters:
        generator - the object, on which the property shall be set
        propertyName - the name of the property, that shall be set
        propertyValue - the value to populate the property with
        Returns:
        a WadlGeneratorLoader.Callback object that must be called later, or null if no callback is required.
        Throws:
        java.lang.Exception - if s.th. goes wrong
      • getMethodByName

        private static java.lang.reflect.Method getMethodByName​(java.lang.String methodName,
                                                                java.lang.Class<?> clazz)