Class DefaultObjectWrapper

    • Method Detail

      • wrapDomNode

        public TemplateModel wrapDomNode​(java.lang.Object obj)
      • convertArray

        protected java.lang.Object convertArray​(java.lang.Object arr)
        Converts an array to a java.util.List.
      • setForceLegacyNonListCollections

        public void setForceLegacyNonListCollections​(boolean forceLegacyNonListCollections)
        Specifies whether non-List Collection-s (like Set-s) must be wrapped by pre-fetching into a SimpleSequence. The modern approach is wrapping into a DefaultNonListCollectionAdapter. This setting only has effect when getUseAdaptersForContainers() is also true, as otherwise SimpleSequence will be used regardless of this. In new projects you should set this to false. At least before incompatible_improvements 2.4.0 it defaults to true, because of backward compatibility concerns: with TemplateSequenceModel templates could access the items by index if they wanted to (the index values were defined by the iteration order). This was not very useful, or was even confusing, and it conflicts with the adapter approach.
        Since:
        2.3.22
        See Also:
        setUseAdaptersForContainers(boolean)
      • setIterableSupport

        public void setIterableSupport​(boolean iterableSupport)
        Specifies whether Iterable-s (not to be confused with Iterator-s) that don't implement any other recognized Java interfaces (most notably Collection) will be recognized as listable objects (TemplateCollectionModel-s), or they will be just seen as generic objects (JavaBean-s). Defaults to false for backward compatibility, but in new projects you should set this to true. Before setting this to true in older projects, check if you have called myIterable.iterator() directly from any templates, because the Java API is only exposed to the templates if the Iterable is wrapped as generic object.
        Since:
        2.3.25
      • getDOMNodeSupport

        public final boolean getDOMNodeSupport()
        Getter pair of setDOMNodeSupport(boolean); see there.
        Since:
        2.3.31
      • setDOMNodeSupport

        public void setDOMNodeSupport​(boolean domNodeSupport)
        Enables wrapping Node-s on a special way (as described in the "XML Processing Guide" in the Manual); defaults to true.. If this is true, Node+s will be wrapped like any other generic object.
        Since:
        2.3.31
        See Also:
        handleUnknownType(Object)
      • getJythonSupport

        public final boolean getJythonSupport()
        Getter pair of setJythonSupport(boolean); see there.
        Since:
        2.3.31
      • setJythonSupport

        public void setJythonSupport​(boolean jythonSupport)
        Enables wrapping Jython objects in a special way; defaults to true. If this is false, they will be wrapped like any other generic object. Note that Jython wrapping is legacy feature, and might by disabled by the selected MemberAccessPolicy, even if this is true; see handleUnknownType(Object).
        Since:
        2.3.31
        See Also:
        handleUnknownType(Object)
      • normalizeIncompatibleImprovementsVersion

        protected static Version normalizeIncompatibleImprovementsVersion​(Version incompatibleImprovements)
        Returns the lowest version number that is equivalent with the parameter version.
        Since:
        2.3.22
      • toPropertiesString

        protected java.lang.String toPropertiesString()
        Description copied from class: BeansWrapper
        Returns the name-value pairs that describe the configuration of this BeansWrapper; called from BeansWrapper.toString(). The expected format is like "foo=bar, baaz=wombat". When overriding this, you should call the super method, and then insert the content before it with a following ", ", or after it with a preceding ", ".
        Overrides:
        toPropertiesString in class BeansWrapper
        Since:
        2.3.22