Class JModuleDirective

  • Direct Known Subclasses:
    JExportsDirective, JRequiresDirective

    public abstract class JModuleDirective
    extends java.lang.Object
    Represents a Java module directive. For example "exports foo.bar;" or "requires foo.baz;".
    Author:
    Tomas Kraus
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JModuleDirective.Type
      Module directive type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name
      Name argument of module directive.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)
      Compares this module directive to the specified object.
      abstract JFormatter generate​(JFormatter f)
      Print source code of this module directive.
      abstract JModuleDirective.Type getType()
      Gets the type of this module directive.
      int hashCode()
      Returns a hash code for this module directive based on directive type and name.
      java.lang.String name()
      Gets the name of this module directive.
      • Methods inherited from class java.lang.Object

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

      • name

        protected final java.lang.String name
        Name argument of module directive.
    • Method Detail

      • getType

        public abstract JModuleDirective.Type getType()
        Gets the type of this module directive.
        Returns:
        type of this module directive. Will never be null.
      • generate

        public abstract JFormatter generate​(JFormatter f)
        Print source code of this module directive.
        Parameters:
        f - Java code formatter.
        Returns:
        provided instance of Java code formatter.
      • equals

        public boolean equals​(java.lang.Object other)
        Compares this module directive to the specified object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - The object to compare this JModuleDirective against.
        Returns:
        true if the argument is not null and is a JModuleDirective object with the same type and equal name.
      • hashCode

        public int hashCode()
        Returns a hash code for this module directive based on directive type and name. The hash code for a module directive is computed as
             97 * (type_ordinal_value + 1) + name.hashCode()
         
        using int arithmetic.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
      • name

        public java.lang.String name()
        Gets the name of this module directive.
        Returns:
        name of this module directive.