Class ModelInstanceImpl

    • Method Detail

      • newInstance

        public <T extends ModelElementInstance> T newInstance​(java.lang.Class<T> type)
        Description copied from interface: ModelInstance
        Creates a new instance of type class.
        Specified by:
        newInstance in interface ModelInstance
        Type Parameters:
        T - instance type
        Parameters:
        type - the class of the type to create
        Returns:
        the new created instance
      • newInstance

        public <T extends ModelElementInstance> T newInstance​(java.lang.Class<T> type,
                                                              java.lang.String id)
        Description copied from interface: ModelInstance
        Creates a new instance of type class with user-defined id.
        Specified by:
        newInstance in interface ModelInstance
        Type Parameters:
        T - instance type
        Parameters:
        type - the class of the type to create
        id - identifier of new element instance
        Returns:
        the new created instance
      • newInstance

        public <T extends ModelElementInstance> T newInstance​(ModelElementType type,
                                                              java.lang.String id)
        Description copied from interface: ModelInstance
        Creates a new instance of type with user-defined id.
        Specified by:
        newInstance in interface ModelInstance
        Type Parameters:
        T - instance type
        Parameters:
        type - the type to create
        id - identifier of new element instance
        Returns:
        the new created instance
      • registerGenericType

        public ModelElementType registerGenericType​(java.lang.String namespaceUri,
                                                    java.lang.String localName)
      • getModelElementById

        public <T extends ModelElementInstance> T getModelElementById​(java.lang.String id)
        Description copied from interface: ModelInstance
        Find a unique element of the model by id.
        Specified by:
        getModelElementById in interface ModelInstance
        Parameters:
        id - the id of the element
        Returns:
        the element with the id or null
      • getModelElementsByType

        public <T extends ModelElementInstance> java.util.Collection<T> getModelElementsByType​(java.lang.Class<T> referencingClass)
        Description copied from interface: ModelInstance
        Find all elements of a type.
        Specified by:
        getModelElementsByType in interface ModelInstance
        Parameters:
        referencingClass - the type class of the elements
        Returns:
        the collection of elements of the type
      • clone

        public ModelInstance clone()
        Description copied from interface: ModelInstance
        Copies the model instance but not the model. So only the wrapped DOM document is cloned. Changes of the model are persistent between multiple model instances.
        Specified by:
        clone in interface ModelInstance
        Overrides:
        clone in class java.lang.Object
        Returns:
        the new model instance
      • validate

        public ValidationResults validate​(java.util.Collection<ModelElementValidator<?>> validators)
        Description copied from interface: ModelInstance
        Validate semantic properties of this model instance using a collection of validators. ModelElementValidator is an SPI that can be implemented by the user to execute custom validation logic on the model. The validation results are collected into a ValidationResults object which is returned by this method.
        Specified by:
        validate in interface ModelInstance
        Parameters:
        validators - the validators to execute
        Returns:
        the results of the validation.