Class DefaultFileArtifactCreator

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkSuffix​(java.io.File file, java.lang.String suffix)
      Returns whether file ends with suffix.
      void configure​(java.util.Properties properties, java.util.List<Message> messages)
      Configures its own reaction according to a set of properties.
      FileArtifact createArtifactInstance​(java.lang.Object real, ArtifactModel model)
      Returns the artifact instance for real.
      java.lang.Class<? extends IArtifact> getArtifactClass()
      The class of the artifact being created.
      boolean handlesArtifact​(java.lang.Class<? extends IArtifact> kind, java.lang.Object real)
      Returns whether this creator handles this type of artifact.
      private boolean handlesFile​(java.io.File file)
      Returns whether this create handles file.
      protected boolean handlesFileImpl​(java.io.File file)
      May specify additional properties of a file.
      • Methods inherited from class java.lang.Object

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

      • patterns

        private java.util.regex.Pattern[] patterns
      • considerBuiltInCheck

        private boolean considerBuiltInCheck
    • Constructor Detail

      • DefaultFileArtifactCreator

        public DefaultFileArtifactCreator()
    • Method Detail

      • checkSuffix

        public static final boolean checkSuffix​(java.io.File file,
                                                java.lang.String suffix)
        Returns whether file ends with suffix.
        Parameters:
        file - the file to be tested
        suffix - the suffix
        Returns:
        true if file ends with suffix, false else
      • handlesFile

        private boolean handlesFile​(java.io.File file)
        Returns whether this create handles file.
        Parameters:
        file - the file to be handled
        Returns:
        true if it handles file, false else
      • handlesFileImpl

        protected boolean handlesFileImpl​(java.io.File file)
        May specify additional properties of a file. It is already guaranteed that file is a file and not a directory.
        Parameters:
        file - the file to be handled
        Returns:
        true if it handles file, false else
      • handlesArtifact

        public boolean handlesArtifact​(java.lang.Class<? extends IArtifact> kind,
                                       java.lang.Object real)
        Description copied from interface: IArtifactCreator
        Returns whether this creator handles this type of artifact.
        Specified by:
        handlesArtifact in interface IArtifactCreator
        Parameters:
        kind - the kind of artifact in terms of a class (typically the top-level interfaces)
        real - the real world object
        Returns:
        true if it can handle the artifact, false else
      • createArtifactInstance

        public FileArtifact createArtifactInstance​(java.lang.Object real,
                                                   ArtifactModel model)
                                            throws VilException
        Description copied from interface: IArtifactCreator
        Returns the artifact instance for real.
        Specified by:
        createArtifactInstance in interface IArtifactCreator
        Parameters:
        real - the real world object
        model - the artifact model to create the artifact within
        Returns:
        the instance or null if real cannot be handled
        Throws:
        VilException - in case that any instance creation problem occurs
      • configure

        public void configure​(java.util.Properties properties,
                              java.util.List<Message> messages)
        Description copied from interface: IArtifactCreator
        Configures its own reaction according to a set of properties. Each artifact creator may look for a property with its own single name and read a comma separated list of regular file path patterns for its configuration. If empty, the artifact creator shall be disabled. If IArtifactCreator.DEFAULT_PATTERN is contained, then the default implementation shall be called, otherwise only the configured entries shall be considered. A creator shall not modify the given properties (exceptions may apply).
        Specified by:
        configure in interface IArtifactCreator
        Parameters:
        properties - the properties to configure on
        messages - configuration messages (to be modified as a side effect)