/** * Method for determining whether annotation processing is enabled or not * (default settings are typically that it is enabled; must explicitly disable). * * @return True if annotation processing is enabled; false if not */ public final boolean isAnnotationProcessingEnabled() { return isEnabled(MapperFeature.USE_ANNOTATIONS); }
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }
/** * Accessor for determining whether it is ok to try to force override of access * modifiers to be able to get or set values of non-public Methods, Fields; * to invoke non-public Constructors, Methods; or to instantiate non-public * Classes. By default this is enabled, but on some platforms it needs to be * prevented since if this would violate security constraints and cause failures. * * @return True if access modifier overriding is allowed (and may be done for * any Field, Method, Constructor or Class); false to prevent any attempts * to override. */ public final boolean canOverrideAccessModifiers() { return isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS); }
public CreatorCollector(BeanDescription beanDesc, MapperConfig<?> config) { _beanDesc = beanDesc; _canFixAccess = config.canOverrideAccessModifiers(); _forceAccess = config .isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS); }
/** * Method for getting {@link AnnotationIntrospector} configured * to introspect annotation values used for configuration. *<p> * Non-final since it is actually overridden by sub-classes (for now?) */ public AnnotationIntrospector getAnnotationIntrospector() { if (isEnabled(MapperFeature.USE_ANNOTATIONS)) { return _base.getAnnotationIntrospector(); } return NopAnnotationIntrospector.instance; }
@Override // since 2.9 public Class<?>[] findDefaultViews() { if (!_defaultViewsResolved) { _defaultViewsResolved = true; Class<?>[] def = (_annotationIntrospector == null) ? null : _annotationIntrospector.findViews(_classInfo); // one more twist: if default inclusion disabled, need to force empty set of views if (def == null) { if (!_config.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) { def = NO_VIEWS; } } _defaultViews = def; } return _defaultViews; }
/** * Method called to further get rid of unwanted individual accessors, * based on read/write settings and rules for "pulling in" accessors * (or not). */ protected void _removeUnwantedAccessor(Map<String, POJOPropertyBuilder> props) { final boolean inferMutators = _config.isEnabled(MapperFeature.INFER_PROPERTY_MUTATORS); Iterator<POJOPropertyBuilder> it = props.values().iterator(); while (it.hasNext()) { POJOPropertyBuilder prop = it.next(); // 26-Jan-2017, tatu: [databind#935]: need to denote removal of JsonProperty.Access acc = prop.removeNonVisible(inferMutators); if (acc == JsonProperty.Access.READ_ONLY) { _collectIgnorals(prop.getName()); } } }
@Override public JsonCreator.Mode findCreatorAnnotation(MapperConfig<?> config, Annotated a) { JsonCreator ann = _findAnnotation(a, JsonCreator.class); if (ann != null) { return ann.mode(); } if (_cfgConstructorPropertiesImpliesCreator && config.isEnabled(MapperFeature.INFER_CREATOR_FROM_CONSTRUCTOR_PROPERTIES) ) { if (a instanceof AnnotatedConstructor) { if (_java7Helper != null) { Boolean b = _java7Helper.hasCreatorAnnotation(a); if ((b != null) && b.booleanValue()) { // 13-Sep-2016, tatu: Judgment call, but I don't think JDK ever implies // use of delegate; assumes as-properties implicitly return JsonCreator.Mode.PROPERTIES; } } } } return null; }
@Override public Object instantiateBean(boolean fixAccess) { AnnotatedConstructor ac = _classInfo.getDefaultConstructor(); if (ac == null) { return null; } if (fixAccess) { ac.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); } try { return ac.getAnnotated().newInstance(); } catch (Exception e) { Throwable t = e; while (t.getCause() != null) { t = t.getCause(); } ClassUtil.throwIfError(t); ClassUtil.throwIfRTE(t); throw new IllegalArgumentException("Failed to instantiate bean of type " +_classInfo.getAnnotated().getName()+": ("+t.getClass().getName()+") " +ClassUtil.exceptionMessage(t), t); } }
protected POJOPropertiesCollector(MapperConfig<?> config, boolean forSerialization, JavaType type, AnnotatedClass classDef, String mutatorPrefix) { _config = config; _stdBeanNaming = config.isEnabled(MapperFeature.USE_STD_BEAN_NAMING); _forSerialization = forSerialization; _type = type; _classDef = classDef; _mutatorPrefix = (mutatorPrefix == null) ? "set" : mutatorPrefix; if (config.isAnnotationProcessingEnabled()) { _useAnnotations = true; _annotationIntrospector = _config.getAnnotationIntrospector(); } else { _useAnnotations = false; _annotationIntrospector = AnnotationIntrospector.nopInstance(); } _visibilityChecker = _config.getDefaultVisibilityChecker(type.getRawClass(), classDef); }
if (_config.isEnabled(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME)) { _renameWithWrappers(props);
if (!prop.isExplicitlyNamed() || _config.isEnabled(MapperFeature.ALLOW_EXPLICIT_PROPERTY_RENAMING)) { if (_forSerialization) { if (prop.hasGetter()) {
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }
/** * Method for determining whether annotation processing is enabled or not * (default settings are typically that it is enabled; must explicitly disable). * * @return True if annotation processing is enabled; false if not */ public final boolean isAnnotationProcessingEnabled() { return isEnabled(MapperFeature.USE_ANNOTATIONS); }
/** * Method for determining whether annotation processing is enabled or not * (default settings are typically that it is enabled; must explicitly disable). * * @return True if annotation processing is enabled; false if not */ public final boolean isAnnotationProcessingEnabled() { return isEnabled(MapperFeature.USE_ANNOTATIONS); }
/** * Accessor for checking whether default settings for property handling * indicate that properties should be alphabetically ordered or not. */ public final boolean shouldSortPropertiesAlphabetically() { return isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY); }