package scalasti
- Alphabetic
- Public
- All
Type Members
-
trait
AttributeRenderer
[T] extends AnyRef
A more Scala-like ST attribute renderer.
A more Scala-like ST attribute renderer. Objects that implement this trait can be registered as attribute renderers with an STGroupString.
- T
the type (class) for which the renderer can render values.
-
class
DateRenderer
extends AttributeRenderer[Date]
A Scalasti version of String Template's
DateRenderer. -
class
NumberRenderer
extends AttributeRenderer[Number]
A Scalasti version of String Template's
NumberRenderer. -
class
ST
extends AnyRef
A Scala interface to a StringTemplate
STtemplate.A Scala interface to a StringTemplate
STtemplate. objet Note that this interface does not directly expose all the underlying ST methods. In particular, this Scala interface is geared primarily toward reading and rendering external templates, not toward generating templates in code.This class cannot be instantiated directly. Instead, use the
apply()methods in the companion object.Because of the way the ST API instantiates templates, this class cannot easily subclass the real ST class. So, it wraps the underlying string template object and stores it internally. You can retrieve the wrapped template object via the
nativeSTmethod. You are free to call methods directly ontemplate, though they will use Java semantics, rather than Scala semantics.Note that this class explicitly handles mapping the following types of values in an attribute map:
- A Scala
Seq(which includes lists and array buffers) is mapped to ajava.util.List, so it's treated as a multivalued attribute by the underlying ST library. - A Scala iterator is also mapped to a
java.util.List. - Numbers and strings are added as is.
- Anything else is treated as a regular object and wrapped in a Java Bean. See below.
Bean Wrapping
Regular objects are, by default, wrapped in a Java Bean, because the underlying String Template API uses Java Bean semantics to access object fields. Thus, if a template references "foo.bar", StringTemplate will expect that the object associated with the name "foo" has a method called
getBar(). To allow Scala objects (and, especially, case class objects) to be used directly, Scalasti automatically generates wrapper Java Beans for them.There are cases where you don't want this behavior, however. For instance, it doesn't make much sense with numeric values or strings, so Scalasti deliberately does not wrap those objects. There are other cases where you might not want the automatic Bean-wrapper behavior; see the
addmethod for more details. - A Scala
-
trait
STErrorListener
extends stringtemplate.v4.STErrorListener
A Scala version of the String Template library's
StringTemplateErrorListenerclass. -
class
STGroup
extends AnyRef
A Scala wrapper for the String Template library's
STGroupclass.A Scala wrapper for the String Template library's
STGroupclass. This class provides access to most of the methods on the underlying class, with Scala semantics, where appropriate. This class cannot be instantiated directly; use theapply()methods on the companion object, or create one of the subclasses.This class does not expose all of the underlying functions of the actual StringTemplate API. If you need access to the full Java StringTemplate API, you can retrieve the underlying
STGroupby calling thenativeGroupmethod. -
class
STGroupDir
extends STGroup
STGroupDirwraps the StringTemplate API'sSTGroupDirclass.STGroupDirwraps the StringTemplate API'sSTGroupDirclass. AnSTGroupDirspecifies a directory or directory tree full of templates and/or group files, with the files loaded on demand. As a subclass ofSTGroup, anSTGroupDircontains all the methods of the parent class. This class cannot be instantiated directly; use theapply()methods on the companion object. -
class
STGroupFile
extends STGroup
STGroupFilewraps the StringTemplate API'sSTGroupFileclass.STGroupFilewraps the StringTemplate API'sSTGroupFileclass. AnSTGroupFileobject reads a template group from a file. See the StringTemplate API documentation for details. SinceSTGroupFilea subclass ofSTGroup, all the methods on the parent class are available on this one. This class cannot be instantiated directly; use theapply()methods on the companion object. -
class
STGroupString
extends STGroup
STGroupStringwraps the StringTemplate API'sSTGroupStringclass.STGroupStringwraps the StringTemplate API'sSTGroupStringclass. AnSTGroupStringobject reads a template group from a string. See the StringTemplate API documentation for details. SinceSTGroupStringa subclass ofSTGroup, all the methods on the parent class are available on this one. This class cannot be instantiated directly; use theapply()methods on the companion object.
Value Members
-
object
Constants
Miscellaneous shared constants.
-
object
ST
Companion object for the
STclass.Companion object for the
STclass. This object providesapply()methods for instantiatingSTobjects. -
object
STGroup
Companion object for the
STGroupclass.Companion object for the
STGroupclass. This object providesapply()methods for instantiatingSTGroupobjects. -
object
STGroupDir
Companion object for
STGroupDir.Companion object for
STGroupDir. This object providesapply()methods for instantiatingSTGroupDirobjects. -
object
STGroupFile
Companion object for
STGroupFile.Companion object for
STGroupFile. This object providesapply()methods for instantiatingSTGroupFileobjects. -
object
STGroupString
Companion object for
STGroupString.Companion object for
STGroupString. This object providesapply()methods for instantiatingSTGroupStringobjects.