Class StereotypeAPI


  • public class StereotypeAPI
    extends Object
    API to apply, update, query, and unapply stereotypes for an EObject.
    • Constructor Detail

      • StereotypeAPI

        public StereotypeAPI()
    • Method Detail

      • applyStereotype

        public static void applyStereotype​(EObject stereotypedElement,
                                           org.modelversioning.emfprofile.Stereotype stereotype)
      • applyStereotype

        public static void applyStereotype​(EObject stereotypedElement,
                                           String stereotypeName)
      • updateStereotypeApplications

        public static boolean updateStereotypeApplications​(EObject stereotypedElement,
                                                           EList<org.modelversioning.emfprofile.Stereotype> stereotypesToBeApplied)
      • setTaggedValue

        public static void setTaggedValue​(EObject stereotypedElement,
                                          Object newValue,
                                          String stereotypeName,
                                          String taggedValueName)
        Sets the specified tagged value on the Stereotype.
        Parameters:
        stereotypedElement - the entity on which the stereotype is applied.
        newValue - the value to be set
        stereotypeName - the stereotype`s name
        taggedValueName - the tagged value`s name
      • isStereotypeApplicable

        public static boolean isStereotypeApplicable​(EObject stereotypedElement,
                                                     org.modelversioning.emfprofile.Stereotype stereotype)
      • isStereotypeApplicable

        public static boolean isStereotypeApplicable​(EObject stereotypedElement,
                                                     String stereotypeName)
      • isStereotypeApplied

        public static boolean isStereotypeApplied​(EObject stereotypedElement,
                                                  org.modelversioning.emfprofile.Stereotype stereotype)
      • isStereotypeApplied

        public static boolean isStereotypeApplied​(EObject stereotypedElement,
                                                  String stereotype)
      • hasStereotypeApplications

        public static boolean hasStereotypeApplications​(EObject stereotypedElement)
      • hasAppliedStereotype

        public static boolean hasAppliedStereotype​(Set<? extends EObject> setOfElements,
                                                   String stereotypeName)
        Checks whether any EObject in the given set has a stereotype with the given name applied.
        Parameters:
        setOfElements - the set of EObjects
        stereotypeName - the stereotype name
        Returns:
        true if there is at least one stereotype application of the given stereotype to an element of the given set; false otherwise.
      • getApplicableStereotypes

        public static EList<org.modelversioning.emfprofile.Stereotype> getApplicableStereotypes​(EObject stereotypedElement)
      • getApplicableStereotypes

        public static EList<org.modelversioning.emfprofile.Stereotype> getApplicableStereotypes​(EObject stereotypedElement,
                                                                                                org.modelversioning.emfprofile.Profile profile)
      • getApplicableStereotypes

        public static EList<org.modelversioning.emfprofile.Stereotype> getApplicableStereotypes​(EObject stereotypedElement,
                                                                                                String stereotypeName)
      • getStereotypeApplications

        public static EList<org.modelversioning.emfprofileapplication.StereotypeApplication> getStereotypeApplications​(EObject stereotypedElement)
      • getStereotypeApplications

        public static EList<org.modelversioning.emfprofileapplication.StereotypeApplication> getStereotypeApplications​(EObject stereotypedElement,
                                                                                                                       org.modelversioning.emfprofile.Profile profile)
      • getStereotypeApplications

        public static EList<org.modelversioning.emfprofileapplication.StereotypeApplication> getStereotypeApplications​(EObject stereotypedElement,
                                                                                                                       String stereotype)
      • getStereotypeApplication

        public static org.modelversioning.emfprofileapplication.StereotypeApplication getStereotypeApplication​(EObject stereotypedElement,
                                                                                                               org.modelversioning.emfprofile.Stereotype stereotype)
      • getAppliedStereotypes

        public static EList<org.modelversioning.emfprofile.Stereotype> getAppliedStereotypes​(EObject stereotypedElement)
      • getTaggedValue

        public static <DATA_TYPE> DATA_TYPE getTaggedValue​(EObject stereotypedElement,
                                                           String taggedValueName,
                                                           String stereotypeName)
        Returns the tagged value of the specified Stereotype.
        Parameters:
        pcmEntity - the entity on which the stereotype is applied
        taggedValueName - the tagged value`s name
        stereotypeName - the stereotype`s name
        Returns:
        the value
      • getTaggedValueSafe

        public static <DATA_TYPE> Optional<DATA_TYPE> getTaggedValueSafe​(EObject stereotypedElement,
                                                                         String taggedValueName,
                                                                         String stereotypeName)
        Returns the tagged value of the specified EObject. This ensures that both the EMFProfile and the Stereotype are applied to it. If this is not the case, an empty Optional is returned.
        Type Parameters:
        DATA_TYPE - the data type of the tagged value
        Parameters:
        stereotypedElement - the entity on which the stereotype is applied
        taggedValueName - the tagged value`s name
        stereotypeName - the stereotype`s name
        Returns:
        the tagged value of the specified EObject
        See Also:
        getTaggedValue(EObject, String, String)
      • unapplyStereotype

        public static void unapplyStereotype​(EObject stereotypedElement,
                                             org.modelversioning.emfprofile.Stereotype stereotype)
      • unapplyStereotype

        public static void unapplyStereotype​(EObject stereotypedElement,
                                             String stereotypeName)
      • getParameters

        public static Collection<EStructuralFeature> getParameters​(org.modelversioning.emfprofile.Stereotype stereotype)
        Returns the EStructuralFeatures that define the Stereotype`s parameters.
        Parameters:
        stereotype - the Stereotype
        Returns:
        the parameters` features
      • getParameter

        public static EStructuralFeature getParameter​(org.modelversioning.emfprofile.Stereotype stereotype,
                                                      String parameterName)
        Returns the EStructuralFeature that defines the given parameter (identified by its name).
        Parameters:
        stereotype - the Stereotype
        parameterName - the parameter`s name
        Returns:
        the parameter`s EStructuralFeature