Class XmlAttribute

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String name  
      private XmlElement parent  
      private java.lang.String value  
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlAttribute​(XmlElement parent, java.lang.String name, java.lang.String value)
      Creates a new XML attribute.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(IArtifactVisitor visitor)
      Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
      private void checkValidity()
      Checks the validity of this object.
      static XmlAttribute create​(XmlElement parent, java.lang.String name, java.lang.String value)
      Creates a new Attribute for given XmlElement, with given name and value.
      static XmlAttribute create​(XmlElement parent, java.lang.String name, java.lang.String value, boolean forceOverwrite)
      Creates a new Attribute for given XmlElement, with given name and value.
      void delete()
      Deletes this artifact.
      Binary getBinary()
      Returns the binary representation of the contents of this artifact for manipulation.
      java.lang.String getName()
      Returns the name of this artifact.
      (package private) java.lang.String getNameSafe()
      Returns the name of this attribute without potential exception.
      XmlElement getParent()
      Returns the parent of this fragment.
      java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
      Returns the string value of this object.
      Text getText()
      Returns the textual representation of the contents of this artifact for manipulation.
      java.lang.String getValue()
      Returns the value of this attribute.
      void rename​(java.lang.String name)
      Renames this artifact.
      (package private) void setName​(java.lang.String name)
      Changes the name of this attribute.
      (package private) void setParent​(XmlElement parent)
      Sets a new parent for this fragment.
      void setValue​(java.lang.String value)
      Changes the value of this attribute.
      void update()
      Called if the underlying real artifact may have been updated, e.g., by overriding it by another file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • name

        private java.lang.String name
      • value

        private java.lang.String value
    • Constructor Detail

      • XmlAttribute

        XmlAttribute​(XmlElement parent,
                     java.lang.String name,
                     java.lang.String value)
        Creates a new XML attribute.
        Parameters:
        parent - the parent element
        name - the name of the attribute
        value - the name of the value
    • Method Detail

      • create

        public static XmlAttribute create​(XmlElement parent,
                                          java.lang.String name,
                                          java.lang.String value)
                                   throws VilException
        Creates a new Attribute for given XmlElement, with given name and value.
        Parameters:
        parent - The XmlElement the attribute is for.
        name - The name of the new attribute.
        value - The value of the new attribute.
        Returns:
        The created XmlAttribute.
        Throws:
        VilException - if attribute could not be created.
      • create

        public static XmlAttribute create​(XmlElement parent,
                                          java.lang.String name,
                                          java.lang.String value,
                                          boolean forceOverwrite)
                                   throws VilException
        Creates a new Attribute for given XmlElement, with given name and value. Overwrites by default.
        Parameters:
        parent - The XmlElement the attribute is for.
        name - The name of the attribute.
        value - The value of the new attribute.
        forceOverwrite - True if existing attributes with same name shall be overwritten. Default = true.
        Returns:
        The created XmlAttribute. The existing attribute if forceOverwrite is false.
        Throws:
        VilException - if attribute could not be created for different reason then pre-existance.
      • delete

        public void delete()
                    throws VilException
        Description copied from interface: IArtifact
        Deletes this artifact.
        Specified by:
        delete in interface IArtifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • getName

        public java.lang.String getName()
                                 throws VilException
        Description copied from interface: IArtifact
        Returns the name of this artifact.
        Specified by:
        getName in interface IArtifact
        Returns:
        the name of this artifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • getNameSafe

        java.lang.String getNameSafe()
        Returns the name of this attribute without potential exception.
        Returns:
        the name
      • getValue

        public java.lang.String getValue()
                                  throws VilException
        Returns the value of this attribute.
        Returns:
        the value of this attribute
        Throws:
        VilException - in case that this object is invalid (was deleted)
      • setValue

        public void setValue​(java.lang.String value)
                      throws VilException
        Changes the value of this attribute.
        Parameters:
        value - the new value of this attribute
        Throws:
        VilException - in case that this object is invalid (was deleted)
      • rename

        public void rename​(java.lang.String name)
                    throws VilException
        Description copied from interface: IArtifact
        Renames this artifact.
        Specified by:
        rename in interface IArtifact
        Parameters:
        name - the new name of this artifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • getText

        public Text getText()
                     throws VilException
        Description copied from interface: IArtifact
        Returns the textual representation of the contents of this artifact for manipulation. In case of binary artifacts, the returned object may be empty.
        Specified by:
        getText in interface IArtifact
        Returns:
        the textual representation of the contents
        Throws:
        VilException - in case of obtaining the representation causes serious problems
      • getBinary

        public Binary getBinary()
                         throws VilException
        Description copied from interface: IArtifact
        Returns the binary representation of the contents of this artifact for manipulation.
        Specified by:
        getBinary in interface IArtifact
        Returns:
        the binary representation of the contents
        Throws:
        VilException - in case of obtaining the representation causes serious problems
      • accept

        public void accept​(IArtifactVisitor visitor)
        Description copied from interface: IArtifact
        Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
        Specified by:
        accept in interface IArtifact
        Parameters:
        visitor - the visitor used for visiting this artifact
      • getParent

        public XmlElement getParent()
        Returns the parent of this fragment.
        Returns:
        the parent of this fragment
      • setParent

        void setParent​(XmlElement parent)
        Sets a new parent for this fragment.
        Parameters:
        parent - the new parent.
      • checkValidity

        private void checkValidity()
                            throws VilException
        Checks the validity of this object.
        Throws:
        VilException - in case that this object is invalid
      • setName

        void setName​(java.lang.String name)
        Changes the name of this attribute.
        Parameters:
        name - the new name of this attribute
      • update

        public void update()
                    throws VilException
        Description copied from interface: IArtifact
        Called if the underlying real artifact may have been updated, e.g., by overriding it by another file.
        Specified by:
        update in interface IArtifact
        Throws:
        VilException - in case that updating fails
      • getStringValue

        public java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
        Description copied from interface: IStringValueProvider
        Returns the string value of this object.
        Specified by:
        getStringValue in interface IStringValueProvider
        Parameters:
        comparator - if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned
        Returns:
        the string value