java.lang.Object
org.apache.camel.quarkus.support.language.runtime.SourceCodeUID
Direct Known Subclasses:
ExpressionUID, ScriptUID

public abstract class SourceCodeUID extends Object
SourceCodeUID is the root class of all implementations of a unique identifier of a source code expressed in a given language.

To be able to retrieve a generated class thanks to its source code, an algorithm is applied to the source code to get a unique name that can be used as simple class name of the generated class.

The current algorithm, hashes first the source code to avoid having an identifier too long, then the result is encoded in base 64 to ensure that all characters are easy to read and finally converted in such way that it can be used as a Java identifier such as a class name.

  • Constructor Details

    • SourceCodeUID

      protected SourceCodeUID(String prefix)
  • Method Details

    • getSourceCode

      protected abstract String getSourceCode()
      Returns:
      the source code to transform into an id.
    • asJavaIdentifier

      public String asJavaIdentifier()
      Returns:
      the source code converted as a Java identifier.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
      Returns:
      the value of asJavaIdentifier().