Java Code Examples for com.fasterxml.jackson.annotation.JsonAutoDetect#Value

The following examples show how to use com.fasterxml.jackson.annotation.JsonAutoDetect#Value . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VisibilityChecker.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override // since 2.9
public Std withOverrides(JsonAutoDetect.Value vis)
{
    Std curr = this;
    if (vis != null) {
        return _with(
                _defaultOrOverride(_getterMinLevel, vis.getGetterVisibility()),
                _defaultOrOverride(_isGetterMinLevel, vis.getIsGetterVisibility()),
                _defaultOrOverride(_setterMinLevel, vis.getSetterVisibility()),
                _defaultOrOverride(_creatorMinLevel, vis.getCreatorVisibility()),
                _defaultOrOverride(_fieldMinLevel, vis.getFieldVisibility())
                );
    }
    return curr;
}
 
Example 2
Source File: AnnotationBasedIntrospector.java    From jackson-jr with Apache License 2.0 5 votes vote down vote up
protected AnnotationBasedIntrospector(Class<?> type, boolean serialization,
        JsonAutoDetect.Value visibility) {
    _type = type;
    _forSerialization = serialization;
    _ignorableNames = serialization ? null : new HashSet<String>();

    // First things first: find possible `@JsonAutoDetect` to override
    // default visibility settings
    JsonAutoDetect ann = _find(type, JsonAutoDetect.class); // bad form but...
    if (ann == null) {
        _visibility = visibility;
    } else {
        _visibility = visibility.withOverrides(JsonAutoDetect.Value.from(ann));
    }
}
 
Example 3
Source File: BasicVisibilityTest.java    From jackson-jr with Apache License 2.0 5 votes vote down vote up
private JSON jsonWithVisibility(JsonAutoDetect.Value vis) {
    return JSON.builder()
            .register(JacksonAnnotationExtension.builder()
                    .withVisibility(vis)
                    .build())
            .build();
}
 
Example 4
Source File: MutableConfigOverride.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 2.9
 */
public MutableConfigOverride setVisibility(JsonAutoDetect.Value v) {
    _visibility = v;
    return this;
}
 
Example 5
Source File: VisibilityChecker.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @since 2.9
 */
public static Std construct(JsonAutoDetect.Value vis) {
    return DEFAULT.withOverrides(vis);
}
 
Example 6
Source File: AnnotationBasedIntrospector.java    From jackson-jr with Apache License 2.0 4 votes vote down vote up
public static POJODefinition pojoDefinitionForDeserialization(JSONReader r,
        Class<?> pojoType, JsonAutoDetect.Value visibility) {
    return new AnnotationBasedIntrospector(pojoType, false, visibility)
            .introspectDefinition();
}
 
Example 7
Source File: AnnotationBasedIntrospector.java    From jackson-jr with Apache License 2.0 4 votes vote down vote up
public static POJODefinition pojoDefinitionForSerialization(JSONWriter w,
        Class<?> pojoType, JsonAutoDetect.Value visibility) {
    return new AnnotationBasedIntrospector(pojoType, true, visibility)
            .introspectDefinition();
}
 
Example 8
Source File: AnnotationBasedValueRWModifier.java    From jackson-jr with Apache License 2.0 4 votes vote down vote up
public AnnotationBasedValueRWModifier(JsonAutoDetect.Value visibility) {
    _visibility = visibility;
}
 
Example 9
Source File: ConfigOverride.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @since 2.9
 */
public JsonAutoDetect.Value getVisibility() { return _visibility; }
 
Example 10
Source File: VisibilityChecker.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Method that can be used for merging default values from `this`
 * instance with specified overrides; and either return `this`
 * if overrides had no effect (that is, result would be equal),
 * or a new instance with merged visibility settings.
 *
 * @since 2.9
 */
public T withOverrides(JsonAutoDetect.Value vis);
 
Example 11
Source File: JacksonAnnotationExtension.java    From jackson-jr with Apache License 2.0 2 votes vote down vote up
/**
 * Method for setting visibility settings to specified parameter and returning
 * resulting builder instance.
 *
 * @param allVisibility Visibility settings to use, or {@code null} to indicate
 *    "use default visibility" (see {@link JacksonAnnotationExtension#DEFAULT_VISIBILITY}).
 *
 * @return Builder with specified visibility settings
 */
public Builder withVisibility(JsonAutoDetect.Value allVisibility) {
    visibility = (allVisibility == null) ? DEFAULT_VISIBILITY : allVisibility;
    return this;
}