code: public GrailsClass addArtefact(String artefactType, GrailsClass artefactGrailsClass) {
          ArtefactHandler handler = artefactHandlersByName.get(artefactType);
          if (handler.isArtefactGrailsClass(artefactGrailsClass)) {
              // Store the GrailsClass in cache
              DefaultArtefactInfo info = getArtefactInfo(artefactType, true);
              info.addGrailsClass(artefactGrailsClass);
              info.updateComplete();
  
              initializeArtefacts(artefactType);
  
              return artefactGrailsClass;
          }
  
          throw new GrailsConfigurationException("Cannot add " + artefactType + " class [" +
                  artefactGrailsClass + "]. It is not a " + artefactType + "!");
      }
docs: Adds an artefact of the given type for the given GrailsClass.
  
  @param artefactType        The type of the artefact as defined by a ArtefactHandler instance
  @param artefactGrailsClass A GrailsClass instance that matches the type defined by the ArtefactHandler
  @return The GrailsClass if successful or null if it couldn't be added
  @throws GrailsConfigurationException If the specified GrailsClass is not the same as the type defined by the ArtefactHandler
  @see grails.core.ArtefactHandler