Package sc.obj

Annotation Type CompilerSettings


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface CompilerSettings
    CompilerSettings is placed on classes in sc layers to affect the generated code for this class when it's processed by scc. Many of the attributes are also inherited by a subclass. It's most commonly set on the base-class of a framework layer, to affect all implementations of that class. For example, it can be set on a base UI component class to affect all UI widgets and their instances to control how inner objects are added as child widgets.

    You can also set this annotation on a compiled class using an annotation layer. This allows subclasses of even compiled classes to have special code generated for them when including a compiled version of that framework jar. Annotation layers don't actually generate new source versions of the code they annotate. It is instead an easy way to control the generated code for applications using framework classes directly - without a wrapper class for each framework class.

    Using the objectTemplate and newTemplate, specify the code templates used to turn this class into a component or object instance. The output from the code template is merged into the original source during code-processing. Other code templates such as mixinTemplate, defineTypesTemplate, and staticMixinTemplate are options for augmenting the generated code in a structured way.

    Set the liveDynamicTypes attribute to enable or disable the liveDynamicTypes feature.

    Set compiledOnly=true/false to disable the dynamic types feature entirely for this class.

    Set needsCompiledClass to force a dynamic stub to be generated for this class if it's made dynamic.

    CompilerSettings also lets you specify a set of packages to be placed into a jar file when this class is included in a project.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean automaticConstructor
      For Components where the template hides the constructor parameters
      java.lang.String childTypeParameter
      For List or other container types, the name of the type param for children
      boolean compiledOnly
      Set to true for classes that must be compiled classes because their implementation won't allow them to be implemented using the SC dynamic stub paradigm.
      boolean constructorInit
      Set to true if your class has to be initialized in a zero-arg constructor
      java.lang.String constructorProperties
      For 'object' types, provides a comma separated list of property names that are set as part of the constructor for the object instance, rather than being initialized later.
      boolean createOnStartup
      If true, the object or class is instantiated when the process starts
      java.lang.String defineTypesMixinTemplate
      A template merged into any subclass of this class that can include code that changes the contract for the type - i.e.
      java.lang.String dynChildManager
      Class implementing IDynChildManager, used to implement obj children on dynamic types
      java.lang.String dynObjManager
      Class implementing IDynObjManager - used to define how objects are constructed
      boolean exportProperties
      Set to false on a type to indicate it does not export it's properties to sub-types in the editor's view of the type
      boolean includeDepsInJar
      If jarFileName is set, should we also include dependent classes in the jar file (excluding system classes)
      boolean inheritProperties
      Set to false on a type, or a base-type so that properties in the base-type are inherited by sub-classes in the editor's view of the type
      java.lang.String initConstructorPropertyMethod
      When constructorProperties is defined for a class, the initConstructorPropertyMethod specifies a static fully qualified method name like: "sc.lang.html.PageInfo.getURLProperty" to call the method: Object sc.lang.html.PageInfo.getURLProperty(String className, String propName, Object defaultValue)
      boolean initOnStartup
      If true, this type's static variables are initialized at process startup.
      java.lang.String jarFileName
      Name of a jar file relative to the build directory
      java.lang.String[] jarPackages
      List of package names to be put into the jar file.
      boolean liveDynamicTypes
      If this type does not support liveDynamicTypes, you can turn this off via this flag
      java.lang.String mixinTemplate
      A template merged into any subclass of this class, useful for collecting children.
      boolean needsCompiledClass
      Set to true for classes that even when dynamic need a specific .class generated for them
      boolean needsPropertyNames
      Set to true for types access with DynUtil.getPropertyNames(type) in Javascript.
      java.lang.String newTemplate
      Specifies the type name for a template file to use for class components
      java.lang.String objectTemplate
      Specifies the type name for a template file to use for obj defs
      java.lang.String onInitMethod
      For components that are created externally (e.g.
      java.lang.String outputMethodTemplate
      A template used to define the default output method's definition for a type defined in the TemplateLanguage
      java.lang.String overrideStartName
      If your class has a final start method but calls some other method, it can still be a component.
      java.lang.String propagateConstructor
      Setting this for a class generates a constructor with the given set of parameter types in any sub-classes of the given type unless that sub-class has a matching constructor defined explicitly.
      java.lang.String srcJarFileName
      Name of a jar file relative to the build directory for packaging the generated Java source
      int startPriority
      Controls the order in which and initOnStartup and createOnStartup types are initialized or started.
      java.lang.String staticMixinTemplate
      A template merged into any subclass of this class that includes static code.
      boolean useAltComponent
      We use generic names with the @Component/IComponent interface which sometimes conflicts with frameworks.
      boolean useExternalDynType
      If true, use a separate class to hold reflective code when useRuntimeReflection = false (i.e.
      boolean useRuntimeReflection
      If false, compile in extra type info to avoid need for reflection
    • Element Detail

      • objectTemplate

        java.lang.String objectTemplate
        Specifies the type name for a template file to use for obj defs
        Default:
        ""
      • newTemplate

        java.lang.String newTemplate
        Specifies the type name for a template file to use for class components
        Default:
        ""
      • mixinTemplate

        java.lang.String mixinTemplate
        A template merged into any subclass of this class, useful for collecting children. When this template is run, the types have been fully merged and so represent the final contract, but that means that new members like methods, or fields added in this template will not be visible to the source code. Use defineTypesMixinTemplate to define new methods, fields, etc. which are needed as part of the API contract of the type. The catch is that this template can not resolve foreign types - it can lookup fields, and base types of the current type.
        Default:
        ""
      • defineTypesMixinTemplate

        java.lang.String defineTypesMixinTemplate
        A template merged into any subclass of this class that can include code that changes the contract for the type - i.e. it is applied during the initTypeInfo. Because of that, it cannot resolve referenced types in the class - it can only lookup fields, annotations etc. on this type and any base types of this type.
        Default:
        ""
      • staticMixinTemplate

        java.lang.String staticMixinTemplate
        A template merged into any subclass of this class that includes static code. This code gets put into a static section of the outer-most class because inner classes cannot have static code sections.
        Default:
        ""
      • outputMethodTemplate

        java.lang.String outputMethodTemplate
        A template used to define the default output method's definition for a type defined in the TemplateLanguage
        Default:
        ""
      • childTypeParameter

        java.lang.String childTypeParameter
        For List or other container types, the name of the type param for children
        Default:
        ""
      • constructorInit

        boolean constructorInit
        Set to true if your class has to be initialized in a zero-arg constructor
        Default:
        false
      • automaticConstructor

        boolean automaticConstructor
        For Components where the template hides the constructor parameters
        Default:
        false
      • onInitMethod

        java.lang.String onInitMethod
        For components that are created externally (e.g. android's activity), specifies the name of a method that will be called which is used for component initialization. The template should define a method called _init where all sc' init code goes. A call to _init is inserted into the onInitMethod.
        Default:
        ""
      • propagateConstructor

        java.lang.String propagateConstructor
        Setting this for a class generates a constructor with the given set of parameter types in any sub-classes of the given type unless that sub-class has a matching constructor defined explicitly. When you set this on a class, it should define a matching constructor TODO: change to @PropagateConstructor and make it Repeatable to support more than one and/or @Propagate on the constructor definition itself.
        Default:
        ""
      • overrideStartName

        java.lang.String overrideStartName
        If your class has a final start method but calls some other method, it can still be a component. Set this property to the name of a method called by start and that method is overridden instead of start.
        Default:
        ""
      • jarFileName

        java.lang.String jarFileName
        Name of a jar file relative to the build directory
        Default:
        ""
      • srcJarFileName

        java.lang.String srcJarFileName
        Name of a jar file relative to the build directory for packaging the generated Java source
        Default:
        ""
      • jarPackages

        java.lang.String[] jarPackages
        List of package names to be put into the jar file. Defaults to all packages in the buildDir
        Default:
        {}
      • includeDepsInJar

        boolean includeDepsInJar
        If jarFileName is set, should we also include dependent classes in the jar file (excluding system classes)
        Default:
        true
      • dynChildManager

        java.lang.String dynChildManager
        Class implementing IDynChildManager, used to implement obj children on dynamic types
        Default:
        ""
      • dynObjManager

        java.lang.String dynObjManager
        Class implementing IDynObjManager - used to define how objects are constructed
        Default:
        ""
      • needsCompiledClass

        boolean needsCompiledClass
        Set to true for classes that even when dynamic need a specific .class generated for them
        Default:
        false
      • compiledOnly

        boolean compiledOnly
        Set to true for classes that must be compiled classes because their implementation won't allow them to be implemented using the SC dynamic stub paradigm. (e.g. a class used by Hibernate or called from code that's no managed as source within StrataCode).
        Default:
        false
      • liveDynamicTypes

        boolean liveDynamicTypes
        If this type does not support liveDynamicTypes, you can turn this off via this flag
        Default:
        true
      • useRuntimeReflection

        boolean useRuntimeReflection
        If false, compile in extra type info to avoid need for reflection
        Default:
        true
      • needsPropertyNames

        boolean needsPropertyNames
        Set to true for types access with DynUtil.getPropertyNames(type) in Javascript. The current generated JS does not otherwise let us find the properties of a type
        Default:
        false
      • useExternalDynType

        boolean useExternalDynType
        If true, use a separate class to hold reflective code when useRuntimeReflection = false (i.e. if you are replacing a JDK class whose signature can't be modified or do not have source to the class you are using in data binding or reflection, and so can't generate a new version of it)
        Default:
        false
      • useAltComponent

        boolean useAltComponent
        We use generic names with the @Component/IComponent interface which sometimes conflicts with frameworks. In that case, set this to true and we'll use the methods: altInit, altStart, etc. methods are used and the interface AltComponent is implemented
        Default:
        false
      • initOnStartup

        boolean initOnStartup
        If true, this type's static variables are initialized at process startup.
        Default:
        false
      • createOnStartup

        boolean createOnStartup
        If true, the object or class is instantiated when the process starts
        Default:
        false
      • startPriority

        int startPriority
        Controls the order in which and initOnStartup and createOnStartup types are initialized or started. Higher priority types are initialized or started first.
        Default:
        0
      • constructorProperties

        java.lang.String constructorProperties
        For 'object' types, provides a comma separated list of property names that are set as part of the constructor for the object instance, rather than being initialized later. It's helpful for properties that should never be null and whose value is available when the instance is created - i.e. it's initialization expression cannot refer to other 'this' properties.
        Default:
        ""
      • initConstructorPropertyMethod

        java.lang.String initConstructorPropertyMethod
        When constructorProperties is defined for a class, the initConstructorPropertyMethod specifies a static fully qualified method name like: "sc.lang.html.PageInfo.getURLProperty" to call the method: Object sc.lang.html.PageInfo.getURLProperty(String className, String propName, Object defaultValue)
        Default:
        ""
      • inheritProperties

        boolean inheritProperties
        Set to false on a type, or a base-type so that properties in the base-type are inherited by sub-classes in the editor's view of the type
        Default:
        true
      • exportProperties

        boolean exportProperties
        Set to false on a type to indicate it does not export it's properties to sub-types in the editor's view of the type
        Default:
        true