Interface TwoPhaseResourceTransformer


public interface TwoPhaseResourceTransformer
Allows implementors to receive metadata captured from build-time processing steps and to decide whether to use an alternate transformation strategy based on that metadata. Use in conjunction with other transformer interfaces to reduce costs when transforming content at product runtime.
  • Method Details

    • loadTwoPhaseProperties

      void loadTwoPhaseProperties(com.atlassian.plugin.elements.ResourceLocation resourceLocation, Function<String,InputStream> loadFromFile)
      For a given file to be transformed, find and load any build-time metadata associated with it.
      Parameters:
      resourceLocation - the locality of a resource within a classpath (e.g., plugin, application container, etc.)
      loadFromFile - a function that can take a relative filepath and return an inputstream for the contents at that filepath. this function should be locked to an appropriate classpath.
    • hasTwoPhaseProperties

      boolean hasTwoPhaseProperties()
      Allows a transformer to decide whether it has enough data to run an alternate transformation strategy using the data loaded when loadTwoPhaseProperties(ResourceLocation, Function) was called.
      Returns:
      true if an alternate transformation strategy should be used, false otherwise