Class AbstractTrait

    • 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.