SIFWorks ADK 2.0
DefaultValueBuilder Class
NamespacesEdustructures.SifWorksDefaultValueBuilder

[This is preliminary documentation and is subject to change.]

The default IValueBuilder implementation evaluates an expression to produce a string value.
Declaration Syntax
C#Visual BasicVisual C++
public class DefaultValueBuilder : IValueBuilder
Public Class DefaultValueBuilder _
	Implements IValueBuilder
public ref class DefaultValueBuilder : IValueBuilder
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
DefaultValueBuilderDefaultValueBuilderNew(IDictionary)
Constructor

static memberAddAlias(String, String)
Registers an alias to a static .Net method.

static memberDefaultClass
Specifies the default class for .Net method calls that do not reference a fully-qualified class name. Edustructures.SifWorks.DefaultValueBuilder is used as the default unless this method is called to change it.

Evaluate(String)
Evaluate an expression that the implementation of this interface understands to return a String value.

EvaluateCode(String)
Calls all .Net methods referenced in the source string to replace the method reference with the string representation of the method's return value

Map
Returns the variables Map

static memberPad(IValueBuilder, String, String, String)
"@pad( Source, PadChar, Width )" Pads the Source string with the specified PadChar character so that the source string is at least Width characters in length. If the Source string is already equal to or greater than Width, no action is taken.

static memberReplaceTokens(String, IDictionary)
Replaces all $(variable) tokens in the source string with the corresponding entry in the supplied Map

static memberToLowerCase(IValueBuilder, String)
"@toLowerCase( Source )" Converts the source string to lowercase

static membertoMixedCase(IValueBuilder, String)
"@toMixedCase( Source )" Converts the source string to mixed case

static memberToUpperCase(IValueBuilder, String)
"@toUpperCase( Source )" Converts the source string to uppercase

Remarks

The IValueBuilder interface is used by the SifDtd, SifDataObject, and Mappings classes when evaluating XPath-like query strings. It enables developers to customize the way the Adk evaluates value expressions in these query strings to produce a value for a SIF element or attribute. The DefaultIValueBuilder implementation supports $(variable) token replacement as well as @com.class.method style calls to static .Net methods.

Token Replacement

When a $(variable) token is found in an expression, it is replaced with a value from the Map passed to evaluate. For example, if the Map constains the entry "color=blue", calling the evaluate method with the expression "The color is $(color)" would produce the string "The color is blue".

.Net Method Calls

When a @method( arg1, arg2, ... ) call is found in an expression, the static .Net method is called and its return value inserted into the value string. Token replacement is performed before calling the method. If method is not fully-qualified, it is assumed to be a method declared by this DefaultIValueBuilder class. The default class can be changed by calling the setDefaultClass method. When writing your own static method, the first parameter must be of type IValueBuilder; zero or more String parameters may follow. The function must return a String: String method( IValueBuilder vb, String p1, String p2, ... ).

Examples
In the following example, the toUpperCase static method is called to convert the $(color) variable to uppercase. This expression would yield the result "The color is BLUE":
CopyC#
The color is @Edustructures.SifWorks.DefaultValueBuilder.ToUpperCase( $(color) )
Inheritance Hierarchy
Object
DefaultValueBuilder

Assembly: Edustructures.SifWorks.Adk (Module: Edustructures.SifWorks.Adk) Version: 2.0.0.10