Class AbstractTrait

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AbstractTrait.Provider
      Basic provider implementation that returns the name of the provided trait.
    • Method Summary

      Modifier and Type Method Description
      protected abstract Node createNode()
      The result of toNode is used for hashCodes and equality.
      boolean equals​(java.lang.Object other)  
      SourceLocation getSourceLocation()
      Gets the source location of a value.
      int hashCode()  
      Node toNode()
      Converts a value to a Node.
      ShapeId toShapeId()
      Gets the shape ID of the trait.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractTrait

        public AbstractTrait​(ShapeId id,
                             FromSourceLocation sourceLocation)
        Parameters:
        id - ID of the trait.
        sourceLocation - Where the trait was defined.
    • Method Detail

      • toShapeId

        public final ShapeId toShapeId()
        Description copied from interface: Trait
        Gets the shape ID of the trait.
        Specified by:
        toShapeId in interface ToShapeId
        Specified by:
        toShapeId in interface Trait
        Returns:
        Returns the fully-qualified shape ID of the trait.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toNode

        public final Node toNode()
        Description copied from interface: ToNode
        Converts a value to a Node.
        Specified by:
        toNode in interface ToNode
        Returns:
        Returns the creates Node.
      • createNode

        protected abstract Node createNode()
        The result of toNode is used for hashCodes and equality. Subclasses must implement createNode to turn the trait into a Node. This is then cached for subsequent retrievals.
        Returns:
        Returns the trait as a node.