StateR

com.phasmidsoftware.xmldoc.render.StateR
See theStateR companion object
case class StateR(maybeName: Option[String], attributes: SmartBuffer, interior: Boolean) extends AutoCloseable

Case class intended to take care of the state of rendering. Rendering is complex for several reasons: (1) a method such as render5 invokes render4, render3, etc. in order to process all of the members of a Product. (2) attributes are special and need to be rendered within the opening tag of the top-level element.

NOTE: attributes is mutable (it's a SmartBuffer). It is retained as we do operations such as setName, recurse. However, we must be careful to ensure that no attribute gets left behind.

Value parameters

attributes

a (private) SmartBuffer: accessible via addAttribute or getAttributes.

interior

false if we are at the top level of an element; true if we have been invoked from above.

maybeName

an optional String.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def addAttribute(attrString: String): StateR

Mutating method to create a this StateR but with attrString appended to the attributes. CONSIDER why is this a mutating method?

Mutating method to create a this StateR but with attrString appended to the attributes. CONSIDER why is this a mutating method?

Value parameters

attrString

an attribute to add to this StateR.

Attributes

Returns

a mutated version of this StateR.

def close(): Unit

Closes the current StateR instance.

Closes the current StateR instance.

Logs a warning if the attributes.result string, after being trimmed, is not empty.

Attributes

Returns

Unit. The method does not return a value.

def getAttributes: String

Mutating method to retrieve the attributes of this StateR and to clear the attributes at the same time.

Mutating method to retrieve the attributes of this StateR and to clear the attributes at the same time.

Attributes

Returns

the attributes originally stored in this StateR.

def getClassName[T : ClassTag]: String

Retrieves the name of the class for the specified type T as a string. If the class name exists, it uses the name directly. Otherwise, it generates the class name by converting the first character of the runtime class name to lowercase and appending the rest. The reason for needing this mechanism is that: (1) Scala classes begin with an upper-case letter; (2) On rendering, the tag is taken from the attribute name (no adjustment required) but when rendering an object at the top level, we need to force the first character to be lower-case.

Retrieves the name of the class for the specified type T as a string. If the class name exists, it uses the name directly. Otherwise, it generates the class name by converting the first character of the runtime class name to lowercase and appending the rest. The reason for needing this mechanism is that: (1) Scala classes begin with an upper-case letter; (2) On rendering, the tag is taken from the attribute name (no adjustment required) but when rendering an object at the top level, we need to force the first character to be lower-case.

Normally, if interior is true, then maybeName is also defined. When interior is false, we tend to generate upper-case tags, which isn't always appropriate. But that situation mostly occurs during testing so it's not so important'

Type parameters

T

the type for which the class name is to be retrieved.

Attributes

Returns

the class name of the specified type T in a string format.

def isInternal: Boolean

Checks if the current state is internal.

Checks if the current state is internal.

Attributes

Returns

true if the state is internal, false otherwise.

Method to create a new StateR with interior set to true.

Method to create a new StateR with interior set to true.

Attributes

Returns

a new StateR.

def setName(name: String): StateR

Method to create a new StateR with a different name.

Method to create a new StateR with a different name.

Value parameters

name

the new name.

Attributes

Returns

a new StateR.

def setName[R <: Product](r: R, index: Int): StateR

Updates the name of the current StateR instance based on the provided product r and its element at the specified index.

Updates the name of the current StateR instance based on the provided product r and its element at the specified index.

Value parameters

index

the index of the element in the product used to set the name.

r

a product instance from which the new name is derived.

Attributes

Returns

a new StateR instance with the updated name.

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product