
org.testifyproject.fasterxml.jackson.annotation.JsonAutoDetect Maven / Gradle / Ivy
package org.testifyproject.testifyproject.fasterxml.jackson.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Member;
import java.lang.reflect.Modifier;
/**
* Class annotation that can be used to org.testifyproject.testifyprojectfine which kinds of Methods
* are to be org.testifyproject.testifyprojecttected by auto-org.testifyproject.testifyprojecttection, and with what minimum access level.
* Auto-org.testifyproject.testifyprojecttection means using name conventions
* and/or signature templates to find methods to use for data binding.
* For example, so-called "getters" can be auto-org.testifyproject.testifyprojecttected by looking for
* public member methods that return a value, do not take argument,
* and have prefix "get" in their name.
*
* Default setting for all accessors is {@link Visibility#DEFAULT}, which
* in turn means that the global org.testifyproject.testifyprojectfaults are used. Defaults
* are different for different accessor types (getters need to be public;
* setters can have any access modifier, for example).
* If you assign different {@link Visibility} type then it will override
* global org.testifyproject.testifyprojectfaults: for example, to require that all setters must be public,
* you would use:
*
* @JsonAutoDetect(setterVisibility=Visibility.PUBLIC_ONLY)
*
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotation
public @interface JsonAutoDetect
{
/**
* Enumeration for possible visibility thresholds (minimum visibility)
* that can be used to limit which methods (and fields) are
* auto-org.testifyproject.testifyprojecttected.
*/
public enum Visibility {
/**
* Value that means that all kinds of access modifiers are acceptable,
* from private to public.
*/
ANY,
/**
* Value that means that any other access modifier other than 'private'
* is considered auto-org.testifyproject.testifyprojecttectable.
*/
NON_PRIVATE,
/**
* Value that means access modifiers 'protected' and 'public' are
* auto-org.testifyproject.testifyprojecttectable (and 'private' and "package access" == no modifiers
* are not)
*/
PROTECTED_AND_PUBLIC,
/**
* Value to indicate that only 'public' access modifier is considered
* auto-org.testifyproject.testifyprojecttectable.
*/
PUBLIC_ONLY,
/**
* Value that indicates that no access modifiers are auto-org.testifyproject.testifyprojecttectable:
* this can be used to explicitly disable auto-org.testifyproject.testifyprojecttection for specified
* types.
*/
NONE,
/**
* Value that indicates that org.testifyproject.testifyprojectfault visibility level (whatever it is,
* org.testifyproject.testifyprojectpends on context) is to be used. This usually means that inherited
* value (from parent visibility settings) is to be used.
*/
DEFAULT;
public boolean isVisible(Member m) {
switch (this) {
case ANY:
return true;
case NONE:
return false;
case NON_PRIVATE:
return !Modifier.isPrivate(m.getModifiers());
case PROTECTED_AND_PUBLIC:
if (Modifier.isProtected(m.getModifiers())) {
return true;
}
// fall through to public case:
case PUBLIC_ONLY:
return Modifier.isPublic(m.getModifiers());
org.testifyproject.testifyprojectfault:
return false;
}
}
}
/**
* Minimum visibility required for auto-org.testifyproject.testifyprojecttecting regular getter methods.
*/
Visibility getterVisibility() org.testifyproject.testifyprojectfault Visibility.DEFAULT;
/**
* Minimum visibility required for auto-org.testifyproject.testifyprojecttecting is-getter methods.
*/
Visibility isGetterVisibility() org.testifyproject.testifyprojectfault Visibility.DEFAULT;
/**
* Minimum visibility required for auto-org.testifyproject.testifyprojecttecting setter methods.
*/
Visibility setterVisibility() org.testifyproject.testifyprojectfault Visibility.DEFAULT;
/**
* Minimum visibility required for auto-org.testifyproject.testifyprojecttecting Creator methods,
* except for no-argument constructors (which are always org.testifyproject.testifyprojecttected
* no matter what).
*/
Visibility creatorVisibility() org.testifyproject.testifyprojectfault Visibility.DEFAULT;
/**
* Minimum visibility required for auto-org.testifyproject.testifyprojecttecting member fields.
*/
Visibility fieldVisibility() org.testifyproject.testifyprojectfault Visibility.DEFAULT;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy