/** * See {@link #setTreatDefaultMethodsAsBeanMembers(boolean)}. */ public boolean getTreatDefaultMethodsAsBeanMembers() { return classIntrospector.getTreatDefaultMethodsAsBeanMembers(); }
/** * Returns the name-value pairs that describe the configuration of this {@link BeansWrapper}; called from * {@link #toString()}. The expected format is like {@code "foo=bar, baaz=wombat"}. When overriding this, you should * call the super method, and then insert the content before it with a following {@code ", "}, or after it with a * preceding {@code ", "}. * * @since 2.3.22 */ protected String toPropertiesString() { // Start with "simpleMapWrapper", because the override in DefaultObjectWrapper expects it to be there! return "simpleMapWrapper=" + simpleMapWrapper + ", " + "exposureLevel=" + classIntrospector.getExposureLevel() + ", " + "exposeFields=" + classIntrospector.getExposeFields() + ", " + "preferIndexedReadMethod=" + preferIndexedReadMethod + ", " + "treatDefaultMethodsAsBeanMembers=" + classIntrospector.getTreatDefaultMethodsAsBeanMembers() + ", " + "sharedClassIntrospCache=" + (classIntrospector.isShared() ? "@" + System.identityHashCode(classIntrospector) : "none"); }
/** * Controls whether Java 8 default methods that weren't overridden in a class will be recognized as bean property * accessors and/or bean actions, and thus will be visible from templates. (We expose bean properties and bean * actions, not methods in general.) Before {@link #getIncompatibleImprovements incompatibleImprovements} 2.3.26 * this defaults to {@code false} for backward compatibility. Starting with {@link #getIncompatibleImprovements * incompatibleImprovements} 2.3.26 it defaults to {@code true}. * <p> * Some explanation: FreeMarker uses {@link java.beans.Introspector} to discover the bean properties and actions of * classes, for maximum conformance to the JavaBeans specification. But for some reason (perhaps just a bug in the * Oracle/OpenJDK Java 8 implementation) that ignores the Java 8 default methods coming from the interfaces. When * this setting is {@code true}, we search for non-overridden default methods ourselves, and add them to the set of * discovered bean members. * * @since 2.3.26 */ public void setTreatDefaultMethodsAsBeanMembers(boolean treatDefaultMethodsAsBeanMembers) { checkModifiable(); if (classIntrospector.getTreatDefaultMethodsAsBeanMembers() != treatDefaultMethodsAsBeanMembers) { ClassIntrospectorBuilder builder = classIntrospector.createBuilder(); builder.setTreatDefaultMethodsAsBeanMembers(treatDefaultMethodsAsBeanMembers); replaceClassIntrospector(builder); } }
/** * See {@link #setTreatDefaultMethodsAsBeanMembers(boolean)}. */ public boolean getTreatDefaultMethodsAsBeanMembers() { return classIntrospector.getTreatDefaultMethodsAsBeanMembers(); }
/** * See {@link #setTreatDefaultMethodsAsBeanMembers(boolean)}. */ public boolean getTreatDefaultMethodsAsBeanMembers() { return classIntrospector.getTreatDefaultMethodsAsBeanMembers(); }
/** * Returns the name-value pairs that describe the configuration of this {@link BeansWrapper}; called from * {@link #toString()}. The expected format is like {@code "foo=bar, baaz=wombat"}. When overriding this, you should * call the super method, and then insert the content before it with a following {@code ", "}, or after it with a * preceding {@code ", "}. * * @since 2.3.22 */ protected String toPropertiesString() { // Start with "simpleMapWrapper", because the override in DefaultObjectWrapper expects it to be there! return "simpleMapWrapper=" + simpleMapWrapper + ", " + "exposureLevel=" + classIntrospector.getExposureLevel() + ", " + "exposeFields=" + classIntrospector.getExposeFields() + ", " + "preferIndexedReadMethod=" + preferIndexedReadMethod + ", " + "treatDefaultMethodsAsBeanMembers=" + classIntrospector.getTreatDefaultMethodsAsBeanMembers() + ", " + "sharedClassIntrospCache=" + (classIntrospector.isShared() ? "@" + System.identityHashCode(classIntrospector) : "none"); }
/** * Returns the name-value pairs that describe the configuration of this {@link BeansWrapper}; called from * {@link #toString()}. The expected format is like {@code "foo=bar, baaz=wombat"}. When overriding this, you should * call the super method, and then insert the content before it with a following {@code ", "}, or after it with a * preceding {@code ", "}. * * @since 2.3.22 */ protected String toPropertiesString() { // Start with "simpleMapWrapper", because the override in DefaultObjectWrapper expects it to be there! return "simpleMapWrapper=" + simpleMapWrapper + ", " + "exposureLevel=" + classIntrospector.getExposureLevel() + ", " + "exposeFields=" + classIntrospector.getExposeFields() + ", " + "preferIndexedReadMethod=" + preferIndexedReadMethod + ", " + "treatDefaultMethodsAsBeanMembers=" + classIntrospector.getTreatDefaultMethodsAsBeanMembers() + ", " + "sharedClassIntrospCache=" + (classIntrospector.isShared() ? "@" + System.identityHashCode(classIntrospector) : "none"); }
/** * Controls whether Java 8 default methods that weren't overridden in a class will be recognized as bean property * accessors and/or bean actions, and thus will be visible from templates. (We expose bean properties and bean * actions, not methods in general.) Before {@link #getIncompatibleImprovements incompatibleImprovements} 2.3.26 * this defaults to {@code false} for backward compatibility. Starting with {@link #getIncompatibleImprovements * incompatibleImprovements} 2.3.26 it defaults to {@code true}. * <p> * Some explanation: FreeMarker uses {@link java.beans.Introspector} to discover the bean properties and actions of * classes, for maximum conformance to the JavaBeans specification. But for some reason (perhaps just a bug in the * Oracle/OpenJDK Java 8 implementation) that ignores the Java 8 default methods coming from the interfaces. When * this setting is {@code true}, we search for non-overridden default methods ourselves, and add them to the set of * discovered bean members. * * @since 2.3.26 */ public void setTreatDefaultMethodsAsBeanMembers(boolean treatDefaultMethodsAsBeanMembers) { checkModifiable(); if (classIntrospector.getTreatDefaultMethodsAsBeanMembers() != treatDefaultMethodsAsBeanMembers) { ClassIntrospectorBuilder builder = classIntrospector.createBuilder(); builder.setTreatDefaultMethodsAsBeanMembers(treatDefaultMethodsAsBeanMembers); replaceClassIntrospector(builder); } }
/** * Controls whether Java 8 default methods that weren't overridden in a class will be recognized as bean property * accessors and/or bean actions, and thus will be visible from templates. (We expose bean properties and bean * actions, not methods in general.) Before {@link #getIncompatibleImprovements incompatibleImprovements} 2.3.26 * this defaults to {@code false} for backward compatibility. Starting with {@link #getIncompatibleImprovements * incompatibleImprovements} 2.3.26 it defaults to {@code true}. * <p> * Some explanation: FreeMarker uses {@link java.beans.Introspector} to discover the bean properties and actions of * classes, for maximum conformance to the JavaBeans specification. But for some reason (perhaps just a bug in the * Oracle/OpenJDK Java 8 implementation) that ignores the Java 8 default methods coming from the interfaces. When * this setting is {@code true}, we search for non-overridden default methods ourselves, and add them to the set of * discovered bean members. * * @since 2.3.26 */ public void setTreatDefaultMethodsAsBeanMembers(boolean treatDefaultMethodsAsBeanMembers) { checkModifiable(); if (classIntrospector.getTreatDefaultMethodsAsBeanMembers() != treatDefaultMethodsAsBeanMembers) { ClassIntrospectorBuilder builder = classIntrospector.createBuilder(); builder.setTreatDefaultMethodsAsBeanMembers(treatDefaultMethodsAsBeanMembers); replaceClassIntrospector(builder); } }