Takas edilen yapılandırma nesnesi

İşleme tabi XML yapılandırması ayrıştırılır ve bundan, eksiksiz yapılandırmayı açıklayan bir Configuration nesnesi oluşturulur.

Nesne, IConfiguration arayüzü tarafından tanımlanır.XML'de tanımlanan tüm nesnelerin bir örneğini içerir.

Bu örnek:

<configuration description="<description of the configuration>">
    <!-- A build provider that takes local device information -->
    <build_provider class="com.android.tradefed.build.BootstrapBuildProvider" />

    <!-- Some target preparation, disabled by default -->
    <target_preparer class="com.android.tradefed.targetprep.PreloadedClassesPreparer">
        <option name="disable" value="true" />
    </target_preparer>

    <!-- One test running some unit tests -->
    <test class="com.android.tradefed.testtype.HostTest">
        <option name="class" value="com.android.tradefed.build.BuildInfoTest" />
    </test>
</configuration>

Sonuç:

  • BootstrapBuildProvider örneği döndürmek için IConfiguration#getBuildProvider().
  • IConfiguration#getTargetPreparers() ile PreloadedClassesPreparer örneğini içeren ITargetPreparer listesini döndürür.
  • HostTest örneğini içeren IRemoteTest listesini döndürmek için IConfiguration#getTests() tuşuna basın.

Yapılandırma nesnesindeki her nesne, XML tanımıyla eşlenebilir. Bu nedenle, XML tanımını anlamak genellikle yapılandırma nesnesinden ne bekleneceğini anlamanıza yardımcı olur.