io.shiftleft.codepropertygraph.generated.nodes.AnnotationParameter.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codepropertygraph-domain-classes_3 Show documentation
Show all versions of codepropertygraph-domain-classes_3 Show documentation
codepropertygraph-domain-classes
The newest version!
package io.shiftleft.codepropertygraph.generated.nodes
import overflowdb._
import scala.jdk.CollectionConverters._
object AnnotationParameter {
def apply(graph: Graph, id: Long) = new AnnotationParameter(graph, id)
val Label = "ANNOTATION_PARAMETER"
object PropertyNames {
val Code = "CODE"
val ColumnNumber = "COLUMN_NUMBER"
val LineNumber = "LINE_NUMBER"
val Order = "ORDER"
val all: Set[String] = Set(Code, ColumnNumber, LineNumber, Order)
val allAsJava: java.util.Set[String] = all.asJava
}
object Properties {
val Code = new overflowdb.PropertyKey[String]("CODE")
val ColumnNumber = new overflowdb.PropertyKey[scala.Int]("COLUMN_NUMBER")
val LineNumber = new overflowdb.PropertyKey[scala.Int]("LINE_NUMBER")
val Order = new overflowdb.PropertyKey[scala.Int]("ORDER")
}
object PropertyDefaults {
val Code = ""
val Order = -1: Int
}
val layoutInformation = new NodeLayoutInformation(
Label,
PropertyNames.allAsJava,
List().asJava,
List(io.shiftleft.codepropertygraph.generated.edges.Ast.layoutInformation).asJava
)
object Edges {
val Out: Array[String] = Array()
val In: Array[String] = Array("AST")
}
val factory = new NodeFactory[AnnotationParameterDb] {
override val forLabel = AnnotationParameter.Label
override def createNode(ref: NodeRef[AnnotationParameterDb]) =
new AnnotationParameterDb(ref.asInstanceOf[NodeRef[NodeDb]])
override def createNodeRef(graph: Graph, id: Long) = AnnotationParameter(graph, id)
}
}
trait AnnotationParameterBase extends AbstractNode with AstNodeBase {
def asStored: StoredNode = this.asInstanceOf[StoredNode]
def code: String
def columnNumber: Option[scala.Int]
def lineNumber: Option[scala.Int]
def order: scala.Int
}
class AnnotationParameter(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/issues/4762 */ )
extends NodeRef[AnnotationParameterDb](graph_4762, id_4762)
with AnnotationParameterBase
with StoredNode
with AstNode {
override def code: String = get().code
override def columnNumber: Option[scala.Int] = get().columnNumber
override def lineNumber: Option[scala.Int] = get().lineNumber
override def order: scala.Int = get().order
override def propertyDefaultValue(propertyKey: String) = {
propertyKey match {
case "CODE" => AnnotationParameter.PropertyDefaults.Code
case "ORDER" => AnnotationParameter.PropertyDefaults.Order
case _ => super.propertyDefaultValue(propertyKey)
}
}
def astIn: Iterator[AnnotationParameterAssign] = get().astIn
override def _astIn = get()._astIn
/** Traverse to ANNOTATION_PARAMETER_ASSIGN via AST IN edge.
*/
def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
get()._annotationParameterAssignViaAstIn
// In view of https://github.com/scala/bug/issues/4762 it is advisable to use different variable names in
// patterns like `class Base(x:Int)` and `class Derived(x:Int) extends Base(x)`.
// This must become `class Derived(x_4762:Int) extends Base(x_4762)`.
// Otherwise, it is very hard to figure out whether uses of the identifier `x` refer to the base class x
// or the derived class x.
// When using that pattern, the class parameter `x_47672` should only be used in the `extends Base(x_4762)`
// clause and nowhere else. Otherwise, the compiler may well decide that this is not just a constructor
// parameter but also a field of the class, and we end up with two `x` fields. At best, this wastes memory;
// at worst both fields go out-of-sync for hard-to-debug correctness bugs.
override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = get().fromNewNode(newNode, mapping)
override def canEqual(that: Any): Boolean = get.canEqual(that)
override def label: String = {
AnnotationParameter.Label
}
override def productElementName(n: Int): String =
n match {
case 0 => "id"
case 1 => "code"
case 2 => "columnNumber"
case 3 => "lineNumber"
case 4 => "order"
}
override def productElement(n: Int): Any =
n match {
case 0 => id
case 1 => code
case 2 => columnNumber
case 3 => lineNumber
case 4 => order
}
override def productPrefix = "AnnotationParameter"
override def productArity = 5
}
class AnnotationParameterDb(ref: NodeRef[NodeDb])
extends NodeDb(ref)
with StoredNode
with AstNode
with AnnotationParameterBase {
override def layoutInformation: NodeLayoutInformation = AnnotationParameter.layoutInformation
private var _code: String = AnnotationParameter.PropertyDefaults.Code
def code: String = _code
private var _columnNumber: Integer = null
def columnNumber: Option[scala.Int] = Option(_columnNumber).asInstanceOf[Option[scala.Int]]
private var _lineNumber: Integer = null
def lineNumber: Option[scala.Int] = Option(_lineNumber).asInstanceOf[Option[scala.Int]]
private var _order: Integer = AnnotationParameter.PropertyDefaults.Order
def order: scala.Int = _order
/** faster than the default implementation */
override def propertiesMap: java.util.Map[String, Any] = {
val properties = new java.util.HashMap[String, Any]
properties.put("CODE", code)
columnNumber.map { value => properties.put("COLUMN_NUMBER", value) }
lineNumber.map { value => properties.put("LINE_NUMBER", value) }
properties.put("ORDER", order)
properties
}
/** faster than the default implementation */
override def propertiesMapForStorage: java.util.Map[String, Any] = {
val properties = new java.util.HashMap[String, Any]
if (!(("") == code)) { properties.put("CODE", code) }
columnNumber.map { value => properties.put("COLUMN_NUMBER", value) }
lineNumber.map { value => properties.put("LINE_NUMBER", value) }
if (!((-1: Int) == order)) { properties.put("ORDER", order) }
properties
}
import overflowdb.traversal._
def astIn: Iterator[AnnotationParameterAssign] = createAdjacentNodeScalaIteratorByOffSet[AnnotationParameterAssign](0)
override def _astIn = createAdjacentNodeScalaIteratorByOffSet[StoredNode](0)
def _annotationParameterAssignViaAstIn: overflowdb.traversal.Traversal[AnnotationParameterAssign] =
astIn.collectAll[AnnotationParameterAssign]
override def label: String = {
AnnotationParameter.Label
}
override def productElementName(n: Int): String =
n match {
case 0 => "id"
case 1 => "code"
case 2 => "columnNumber"
case 3 => "lineNumber"
case 4 => "order"
}
override def productElement(n: Int): Any =
n match {
case 0 => id
case 1 => code
case 2 => columnNumber
case 3 => lineNumber
case 4 => order
}
override def productPrefix = "AnnotationParameter"
override def productArity = 5
override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[AnnotationParameterDb]
override def property(key: String): Any = {
key match {
case "CODE" => this._code
case "COLUMN_NUMBER" => this._columnNumber
case "LINE_NUMBER" => this._lineNumber
case "ORDER" => this._order
case _ => null
}
}
override protected def updateSpecificProperty(key: String, value: Object): Unit = {
key match {
case "CODE" => this._code = value.asInstanceOf[String]
case "COLUMN_NUMBER" => this._columnNumber = value.asInstanceOf[scala.Int]
case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[scala.Int]
case "ORDER" => this._order = value.asInstanceOf[scala.Int]
case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key)
}
}
override def removeSpecificProperty(key: String): Unit =
this.updateSpecificProperty(key, null)
override def _initializeFromDetached(
data: overflowdb.DetachedNodeData,
mapper: java.util.function.Function[overflowdb.DetachedNodeData, Node]
) =
fromNewNode(data.asInstanceOf[NewNode], nn => mapper.apply(nn).asInstanceOf[StoredNode])
override def fromNewNode(newNode: NewNode, mapping: NewNode => StoredNode): Unit = {
this._code = newNode.asInstanceOf[NewAnnotationParameter].code
this._columnNumber = newNode.asInstanceOf[NewAnnotationParameter].columnNumber match {
case None => null; case Some(value) => value
}
this._lineNumber = newNode.asInstanceOf[NewAnnotationParameter].lineNumber match {
case None => null; case Some(value) => value
}
this._order = newNode.asInstanceOf[NewAnnotationParameter].order
}
}