Class ManifestModel

java.lang.Object
com.android.manifmerger.ManifestModel
All Implemented Interfaces:
com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes>

@Immutable public class ManifestModel extends Object implements com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes>
Model for the manifest file merging activities.

This model will describe each element that is eligible for merging and associated merging policies. It is not reusable as most of its interfaces are private but a future enhancement could easily make this more generic/reusable if we need to merge more than manifest files.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a DocumentModel to be used for merging Android manifest documents
    ManifestModel(boolean autoReject)
    Creates a DocumentModel to be used for merging Android manifest documents
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    com.android.manifmerger.ManifestModel.NodeTypes
    fromXmlSimpleName(String xmlSimpleName)
    Returns the ManifestModel.NodeTypes instance from an xml element name (without namespace decoration).
    toXmlName(com.android.manifmerger.ManifestModel.NodeTypes type)
    Returns the Xml name for this node type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ManifestModel

      public ManifestModel()
      Creates a DocumentModel to be used for merging Android manifest documents
    • ManifestModel

      public ManifestModel(boolean autoReject)
      Creates a DocumentModel to be used for merging Android manifest documents
      Parameters:
      autoReject - specifies whether model can ignore conflicts in attribute values when merging manifest documents and simply reject value from the lower priority document
  • Method Details

    • toXmlName

      public String toXmlName(@NonNull com.android.manifmerger.ManifestModel.NodeTypes type)
      Returns the Xml name for this node type
      Specified by:
      toXmlName in interface com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes>
    • fromXmlSimpleName

      public com.android.manifmerger.ManifestModel.NodeTypes fromXmlSimpleName(String xmlSimpleName)
      Returns the ManifestModel.NodeTypes instance from an xml element name (without namespace decoration). For instance, an xml element
      
       <activity android:name="foo">
           ...
       </activity>
       
      has a xml simple name of "activity" which will resolve to ManifestModel.NodeTypes.ACTIVITY value.

      Note : a runtime exception will be generated if no mapping from the simple name to a ManifestModel.NodeTypes exists.

      Specified by:
      fromXmlSimpleName in interface com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes>
      Parameters:
      xmlSimpleName - the xml (lower-hyphen separated words) simple name.
      Returns:
      the ManifestModel.NodeTypes associated with that element name.
    • autoRejectConflicts

      public boolean autoRejectConflicts()
      Specified by:
      autoRejectConflicts in interface com.android.manifmerger.DocumentModel<com.android.manifmerger.ManifestModel.NodeTypes>