docbox.strategy

Abstract Class AbstractTemplateStrategy

lucee.Component
    extended by docbox.strategy.AbstractTemplateStrategy
Direct Known Subclasses:
HTMLAPIStrategy , XMIStrategy

Abstract base class for general templating strategies
Copyright 2015 Ortus Solutions, Corp www.ortussolutions.com

Class Attributes:
  • doc_abstract : true
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    struct functionQueryCache
          The function query cache.

    • access = public
    • returntype = any
    true false
    struct propertyQueryCache
          The property query cache.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    query buildFunctionMetaData(struct metadata)
         builds a sorted query of function meta.
    struct buildPackageTree(query qMetadata)
         builds a data structure that shows the tree structure of the packages.
    query buildPropertyMetaData(struct metadata)
         builds a sorted query of property meta.
    private boolean classExists(query qMetadata, string className, string package)
         Whether or not the CFC class exists (does not test for primitives).
    private AbstractTemplateStrategy ensureDirectory(string path)
         Ensure directory.
    string getFunctionQueryCache()
    private array getGenericTypes(struct meta, string package)
         return an array of generic types associated with this function/argument.
    private query getMetaSubQuery(query query, [string where], [string orderBy])
         Query of Queries helper.
    private string getObjectName(any class)
         Returns the simple object name from a full class name.
    private string getPackage(any class)
         Get a package from an incoming class.
    private struct getPropertyMeta(string name, array properties)
         returns the property meta by a given name.
    string getPropertyQueryCache()
    private boolean isAbstractClass(string class, string package)
         is this class annotated as an abstract class?.
    private boolean isPrimitive(string type)
         Is the type a privite value.
    private string resolveClassName(string className, string package)
         Resolves a class name that may not be full qualified.
    AbstractTemplateStrategy run()
         Runs the strategy.
    private any safeFunctionMeta(any func, struct metadata)
         Sets default values on function metadata.
    private struct safeParamMeta(struct param)
         Sets a default meta type if not found.
    private any safePropertyMeta(any property, struct metadata)
         Sets default values on property metadata.
    any setFunctionQueryCache(struct functionQueryCache)
    any setPropertyQueryCache(struct propertyQueryCache)
    private boolean typeExists(query qMetadata, string className, string package)
         Whether a type exists at all - be it class name, or primitive type.
    private AbstractTemplateStrategy visitPackageTree(struct packageTree, any startCommand, any endCommand, [struct args='[runtime expression]'])
         visit each element on the package tree.
    private AbstractTemplateStrategy writeTemplate(string path, string template)
         Builds a template.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    functionQueryCache

    property struct functionQueryCache

    The function query cache

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    propertyQueryCache

    property struct propertyQueryCache

    The property query cache

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    buildFunctionMetaData

    public query buildFunctionMetaData(struct metadata)

    builds a sorted query of function meta

    Parameters:
    metadata

    buildPackageTree

    public struct buildPackageTree(query qMetadata)

    builds a data structure that shows the tree structure of the packages

    Parameters:
    qMetadata
    Returns:
    string,struct

    buildPropertyMetaData

    public query buildPropertyMetaData(struct metadata)

    builds a sorted query of property meta

    Parameters:
    metadata

    classExists

    private boolean classExists(query qMetadata, string className, string package)

    Whether or not the CFC class exists (does not test for primitives)

    Parameters:
    qMetadata - The metadata query
    className - The name of the class
    package - The package the class comes from

    ensureDirectory

    private AbstractTemplateStrategy ensureDirectory(string path)

    Ensure directory

    Parameters:
    path - The target path

    getFunctionQueryCache

    public string getFunctionQueryCache()


    getGenericTypes

    private array getGenericTypes(struct meta, string package)

    return an array of generic types associated with this function/argument

    Parameters:
    meta - Either function, or argument metadata
    package - The package we are currently in

    getMetaSubQuery

    private query getMetaSubQuery(query query, [string where], [string orderBy])

    Query of Queries helper

    Parameters:
    query - The metadata query
    where - The where string
    orderBy - The order by string

    getObjectName

    private string getObjectName(any class)

    Returns the simple object name from a full class name

    Parameters:
    class - The name of the class

    getPackage

    private string getPackage(any class)

    Get a package from an incoming class

    Parameters:
    class - The name of the class

    getPropertyMeta

    private struct getPropertyMeta(string name, array properties)

    returns the property meta by a given name

    Parameters:
    name - The name of the property
    properties - The property meta

    getPropertyQueryCache

    public string getPropertyQueryCache()


    isAbstractClass

    private boolean isAbstractClass(string class, string package)

    is this class annotated as an abstract class?

    Parameters:
    class - The class name
    package - The package we are currently in

    isPrimitive

    private boolean isPrimitive(string type)

    Is the type a privite value

    Parameters:
    type - The cf type

    resolveClassName

    private string resolveClassName(string className, string package)

    Resolves a class name that may not be full qualified

    Parameters:
    className - The name of the class
    package - The package the class comes from

    run

    public AbstractTemplateStrategy run()

    Runs the strategy


    safeFunctionMeta

    private any safeFunctionMeta(any func, struct metadata)

    Sets default values on function metadata

    Parameters:
    func - The function metadata
    metadata - The original metadata

    safeParamMeta

    private struct safeParamMeta(struct param)

    Sets a default meta type if not found

    Parameters:
    param - The struct meta

    safePropertyMeta

    private any safePropertyMeta(any property, struct metadata)

    Sets default values on property metadata

    Parameters:
    property - The property metadata
    metadata - The original metadata

    setFunctionQueryCache

    public any setFunctionQueryCache(struct functionQueryCache)

    Parameters:
    functionQueryCache

    setPropertyQueryCache

    public any setPropertyQueryCache(struct propertyQueryCache)

    Parameters:
    propertyQueryCache

    typeExists

    private boolean typeExists(query qMetadata, string className, string package)

    Whether a type exists at all - be it class name, or primitive type

    Parameters:
    qMetadata - The metadata query
    className - The name of the class
    package - The package the class comes from

    visitPackageTree

    private AbstractTemplateStrategy visitPackageTree(struct packageTree, any startCommand, any endCommand, [struct args='[runtime expression]'])

    visit each element on the package tree

    Parameters:
    packageTree - The package tree
    startCommand - the command to call on each visit
    endCommand - the command to call on each visit
    args - the extra arguments to get passed on to the visitor command (name, and fullname get passed by default)

    writeTemplate

    private AbstractTemplateStrategy writeTemplate(string path, string template)

    Builds a template

    Parameters:
    path - Where to write the template
    template - The template to write out