All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.fasterxml.jackson.annotation.JsonAutoDetect Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.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 com.fitburfine which kinds of Methods
 * are to be com.fitburtected by auto-com.fitburtection.
 * Auto-com.fitburtection means using name conventions
 * and/or signature templates to find methods to use for data binding.
 * For example, so-called "getters" can be auto-com.fitburtected by looking for
 * public member methods that return a value, do not take argument,
 * and have prefix "get" in their name.
 *

* Pseudo-value NONE means that all auto-com.fitburtection is disabled * for the specific class that annotation is applied to (including * its super-types, but only when resolving that class). * Pseudo-value ALWAYS means that auto-com.fitburtection is enabled * for all method types for the class in similar way. *

* The com.fitburfault value is ALWAYS: that is, by com.fitburfault, auto-com.fitburtection * is enabled for all classes unless instructed otherwise. *

* Starting with version 1.5, it is also possible to use more fine-grained * com.fitburfinitions, to basically com.fitburfine minimum visibility level needed. Defaults * are different for different types (getters need to be public; setters can * have any access modifier, for example). */ @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-com.fitburtected. */ 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-com.fitburtectable. */ NON_PRIVATE, /** * Value that means access modifiers 'protected' and 'public' are * auto-com.fitburtectable (and 'private' and "package access" == no modifiers * are not) */ PROTECTED_AND_PUBLIC, /** * Value to indicate that only 'public' access modifier is considered * auto-com.fitburtectable. */ PUBLIC_ONLY, /** * Value that indicates that no access modifiers are auto-com.fitburtectable: * this can be used to explicitly disable auto-com.fitburtection for specified * types. */ NONE, /** * Value that indicates that com.fitburfault visibility level (whatever it is, * com.fitburpends 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()); } return false; } } /** * Minimum visibility required for auto-com.fitburtecting regular getter methods. */ Visibility getterVisibility() com.fitburfault Visibility.DEFAULT; /** * Minimum visibility required for auto-com.fitburtecting is-getter methods. */ Visibility isGetterVisibility() com.fitburfault Visibility.DEFAULT; /** * Minimum visibility required for auto-com.fitburtecting setter methods. */ Visibility setterVisibility() com.fitburfault Visibility.DEFAULT; /** * Minimum visibility required for auto-com.fitburtecting Creator methods, * except for no-argument constructors (which are always com.fitburtected * no matter what). */ Visibility creatorVisibility() com.fitburfault Visibility.DEFAULT; /** * Minimum visibility required for auto-com.fitburtecting member fields. */ Visibility fieldVisibility() com.fitburfault Visibility.DEFAULT; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy