Class Advice


  • public class Advice
    extends java.lang.Object
    Establishes a link to a variability model for resolving names in tools. However, variability model identifiers are actually resolved at runtime from the actual configuration instance passed in.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • Advice

        public Advice​(java.lang.String name,
                      IVersionRestriction restrictions,
                      Project resolved)
        Creates an advice annotation.
        Parameters:
        name - The name of the project to be imported.
        restrictions - the optional version restrictions that apply (may be null if absent)
        resolved - the resolved project, may be null if no resolution is possible
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the variability model.
        Returns:
        the name of the variability model
      • getVersionRestriction

        public IVersionRestriction getVersionRestriction()
        Returns the version restrictions.
        Returns:
        the version restrictions (may be null if absent)
      • getResolved

        public Project getResolved()
        Returns the resolved project.
        Returns:
        the resolved project, may be null if no resolution is possible
      • accept

        public java.lang.Object accept​(IVisitor visitor)
                                throws VilException
        Accepts the visitor for visiting.
        Parameters:
        visitor - the visitor to be used
        Returns:
        the result of visiting this instance (may be null)
        Throws:
        VilException - in case that visiting fails (e.g., execution)
      • getIvmlElement

        public java.lang.Object getIvmlElement​(java.lang.String name)
        Returns whether name can be resolved to an IVML element.
        Parameters:
        name - the name to be resolved
        Returns:
        the IVML element (value, containable model element), null else
      • getIvmlElement

        public static java.lang.Object getIvmlElement​(IResolutionScope scope,
                                                      java.lang.String name)
        Returns whether name can be resolved to an IVML element in scope.
        Parameters:
        scope - the resolution scope
        name - the name to be resolved
        Returns:
        the IVML element (value, containable model element), null else
      • create

        public static Advice create​(java.lang.String name,
                                    java.net.URI modelURI,
                                    IVersionRestriction restrictions,
                                    java.lang.StringBuilder warning)
        Creates an advice by resolving name to a variability model.
        Parameters:
        name - the name to be resolved
        modelURI - the URI of the model
        restrictions - the version restrictions
        warning - a string builder to append warnings to
        Returns:
        the created advice instance