Search in sources :

Example 1 with SettingsMicroDocumentConverter

use of com.helger.settings.exchange.xml.SettingsMicroDocumentConverter in project phoss-smp by phax.

the class SMPSettingsManagerXML method createWriteData.

@Override
@Nonnull
protected IMicroDocument createWriteData() {
    final IMicroDocument ret = new MicroDocument();
    final SettingsMicroDocumentConverter<Settings> aConverter = new SettingsMicroDocumentConverter<>(ISettingsFactory.newInstance());
    ret.appendChild(aConverter.convertToMicroElement(m_aSettings.getAsSettings(), null, "root"));
    return ret;
}
Also used : IMicroDocument(com.helger.xml.microdom.IMicroDocument) MicroDocument(com.helger.xml.microdom.MicroDocument) SettingsMicroDocumentConverter(com.helger.settings.exchange.xml.SettingsMicroDocumentConverter) IMicroDocument(com.helger.xml.microdom.IMicroDocument) ISettings(com.helger.settings.ISettings) Settings(com.helger.settings.Settings) Nonnull(javax.annotation.Nonnull)

Example 2 with SettingsMicroDocumentConverter

use of com.helger.settings.exchange.xml.SettingsMicroDocumentConverter in project phoss-smp by phax.

the class SMPSettingsManagerXML method onRead.

@Override
@Nonnull
protected EChange onRead(@Nonnull final IMicroDocument aDoc) {
    final SettingsMicroDocumentConverter<Settings> aConverter = new SettingsMicroDocumentConverter<>(ISettingsFactory.newInstance());
    final ISettings aSettings = aConverter.convertToNative(aDoc.getDocumentElement());
    m_aSettings.initFromSettings(aSettings);
    return EChange.UNCHANGED;
}
Also used : SettingsMicroDocumentConverter(com.helger.settings.exchange.xml.SettingsMicroDocumentConverter) ISettings(com.helger.settings.ISettings) ISettings(com.helger.settings.ISettings) Settings(com.helger.settings.Settings) Nonnull(javax.annotation.Nonnull)

Aggregations

ISettings (com.helger.settings.ISettings)2 Settings (com.helger.settings.Settings)2 SettingsMicroDocumentConverter (com.helger.settings.exchange.xml.SettingsMicroDocumentConverter)2 Nonnull (javax.annotation.Nonnull)2 IMicroDocument (com.helger.xml.microdom.IMicroDocument)1 MicroDocument (com.helger.xml.microdom.MicroDocument)1