Interface IChemObjectIO

    • Method Detail

      • accepts

        boolean accepts​(Class<? extends IChemObject> classObject)
        Returns whether the given IChemObject can be read or written.
        Parameters:
        classObject - IChemObject of which is tested if it can be handled.
        Returns:
        true, if the IChemObject can be handled.
      • getIOSettings

        IOSetting[] getIOSettings()
        Returns an array of IOSettings defined by this IChemObjectIO class.
        Returns:
        the IOSettings for this class.
      • addSetting

        <S extends IOSetting> S addSetting​(IOSetting setting)
        Add an IOSetting to the reader/writer. If the name clashes with another setting the original setting will be returned. This method should be called when assigning field settings:
        
         private BooleanIOSetting setting; // field
        
         ...
        
         setting = addSetting(new BooleanIOSetting("setting", ...));
         // if setting was already added we are now using the correct instance
        
        
        Parameters:
        setting - setting to add
        Returns:
        usable setting
        See Also:
        SettingManager.add(org.openscience.cdk.interfaces.ISetting)
      • addSettings

        void addSettings​(Collection<IOSetting> settings)
        Adds a collection of IOSettings to the reader/writer. This is useful for transferring/propagating settings between different reader/writer. When the new settings are added if there is a setting with the same name already stored the value for the new setting is set on the managed setting (See. IteratingSDFReader/SDFWriter for propagation examples). Note that if the setting is invalid (a CDKException thrown) then the setting will not be set.
        
         // two different readers (of same or different type)
         IChemObjectReader reader1 = ...;
         IChemObjectReader reader2 = ...;
        
         // settings transferred from reader2 to reader1
         reader1.addSettings(reader2.getSettings());
         
        Parameters:
        settings - collection of settings to add
        See Also:
        getSettings()
      • hasSetting

        boolean hasSetting​(String name)
        Determine whether this reader/writer has a setting of the provided name.
        Parameters:
        name - name of a setting
        Returns:
        whether the setting is available
        See Also:
        SettingManager.has(String)
      • getSetting

        <S extends IOSetting> S getSetting​(String name)
        Access a named setting managed by this reader/writer.
        Type Parameters:
        S - type to cast to
        Parameters:
        name - name of the setting
        Returns:
        instance of the setting for the name (InvalidParameterException is thrown if no setting for the provided name is found)
        See Also:
        getSetting(String, Class), SettingManager.get(String)
      • getSetting

        <S extends IOSetting> S getSetting​(String name,
                                           Class<S> c)
        Access a named setting managed by this reader/writer.
        Type Parameters:
        S - type to cast to
        Parameters:
        name - name of the setting
        c - the class of the setting (matching generic return type). This is need as due to type erasure we don't know the class of 'S' at runtime.
        Returns:
        instance of the setting for the name (InvalidParameterException is thrown if no setting for the provided name is found)
        See Also:
        getSetting(String), SettingManager.get(String, Class)