本文整理汇总了Java中com.fasterxml.jackson.databind.introspect.VisibilityChecker类的典型用法代码示例。如果您正苦于以下问题:Java VisibilityChecker类的具体用法?Java VisibilityChecker怎么用?Java VisibilityChecker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VisibilityChecker类属于com.fasterxml.jackson.databind.introspect包,在下文中一共展示了VisibilityChecker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectResults
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
/**
* After the modifications are applied, it may be useful for manipulators
* to provide caller with a structured, computer-readable output or summary of the changes.
* This is done in the form of a JSON document stored in the root target
* directory.
* The output data are generated from the fields of the state objects,
* which must be actively marked by {@link JsonProperty} annotation
* to be processed.
* The result is a map from short state class names
* to the result of the state serialization.
* Keys with empty values are excluded.
*
* @param session the container session for manipulation.
* @throws ManipulationException if an error occurs.
*/
private String collectResults( final ManipulationSession session )
throws ManipulationException, JsonProcessingException
{
final ObjectMapper MAPPER = new ObjectMapper();
VisibilityChecker<?> vc = MAPPER.getSerializationConfig()
.getDefaultVisibilityChecker()
.withCreatorVisibility( JsonAutoDetect.Visibility.NONE )
.withFieldVisibility( JsonAutoDetect.Visibility.NONE )
.withGetterVisibility( JsonAutoDetect.Visibility.NONE )
.withIsGetterVisibility( JsonAutoDetect.Visibility.NONE )
.withSetterVisibility( JsonAutoDetect.Visibility.NONE );
MAPPER.setVisibility( vc );
MAPPER.configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false );
ObjectNode root = MAPPER.createObjectNode();
for ( final Map.Entry<Class<?>, State> stateEntry : session.getStatesCopy() )
{
JsonNode node = MAPPER.convertValue( stateEntry.getValue(), JsonNode.class );
if ( node.isObject() && node.size() != 0 )
{
root.set( stateEntry.getKey().getSimpleName(), node );
}
}
return MAPPER.writeValueAsString( root );
}
示例2: BaseSettings
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public BaseSettings(ClassIntrospector ci, AnnotationIntrospector ai,
VisibilityChecker<?> vc, PropertyNamingStrategy pns, TypeFactory tf,
TypeResolverBuilder<?> typer, DateFormat dateFormat, HandlerInstantiator hi,
Locale locale, TimeZone tz, Base64Variant defaultBase64)
{
_classIntrospector = ci;
_annotationIntrospector = ai;
_visibilityChecker = vc;
_propertyNamingStrategy = pns;
_typeFactory = tf;
_typeResolverBuilder = typer;
_dateFormat = dateFormat;
_handlerInstantiator = hi;
_locale = locale;
_timeZone = tz;
_defaultBase64 = defaultBase64;
}
示例3: getDefaultVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
@Override
public VisibilityChecker<?> getDefaultVisibilityChecker()
{
VisibilityChecker<?> vchecker = super.getDefaultVisibilityChecker();
if (!isEnabled(MapperFeature.AUTO_DETECT_GETTERS)) {
vchecker = vchecker.withGetterVisibility(Visibility.NONE);
}
// then global overrides (disabling)
if (!isEnabled(MapperFeature.AUTO_DETECT_IS_GETTERS)) {
vchecker = vchecker.withIsGetterVisibility(Visibility.NONE);
}
if (!isEnabled(MapperFeature.AUTO_DETECT_FIELDS)) {
vchecker = vchecker.withFieldVisibility(Visibility.NONE);
}
return vchecker;
}
示例4: getPage
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
private static MobileScreen getPage(File file) throws Throwable {
MobileScreen mobileScreen;
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
try {
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY));
mobileScreen = mapper.readValue(file, MobileScreen.class);
} catch (Exception e) {
e.printStackTrace();
throw e.getCause();
}
return mobileScreen;
}
示例5: jongo
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
@Bean
public Jongo jongo() {
DB db = mongoClient.getDB(mongoProperties.getMongoClientDatabase());
Mapper mapper =
new JacksonMapper.Builder()
.registerModule(new Jdk8Module())
.registerModule(new GuavaModule())
.setVisibilityChecker(VisibilityChecker.Std.defaultInstance())
.build();
return new Jongo(db, mapper);
}
示例6: findAutoDetectVisibility
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
@Override
public VisibilityChecker<?> findAutoDetectVisibility(AnnotatedClass annotatedClass, VisibilityChecker<?> checker) {
return checker.withFieldVisibility(Visibility.PUBLIC_ONLY)
.withSetterVisibility(Visibility.NONE)
.withGetterVisibility(Visibility.NONE)
.withIsGetterVisibility(Visibility.NONE);
}
示例7: BaseSettings
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public BaseSettings(ClassIntrospector paramClassIntrospector, AnnotationIntrospector paramAnnotationIntrospector, VisibilityChecker<?> paramVisibilityChecker, PropertyNamingStrategy paramPropertyNamingStrategy, TypeFactory paramTypeFactory, TypeResolverBuilder<?> paramTypeResolverBuilder, DateFormat paramDateFormat, HandlerInstantiator paramHandlerInstantiator, Locale paramLocale, TimeZone paramTimeZone, Base64Variant paramBase64Variant)
{
this._classIntrospector = paramClassIntrospector;
this._annotationIntrospector = paramAnnotationIntrospector;
this._visibilityChecker = paramVisibilityChecker;
this._propertyNamingStrategy = paramPropertyNamingStrategy;
this._typeFactory = paramTypeFactory;
this._typeResolverBuilder = paramTypeResolverBuilder;
this._dateFormat = paramDateFormat;
this._handlerInstantiator = paramHandlerInstantiator;
this._locale = paramLocale;
this._timeZone = paramTimeZone;
this._defaultBase64 = paramBase64Variant;
}
示例8: with
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public final BaseSettings with(TimeZone paramTimeZone)
{
if (paramTimeZone == null)
throw new IllegalArgumentException();
DateFormat localDateFormat1 = this._dateFormat;
Object localObject;
if ((localDateFormat1 instanceof StdDateFormat))
{
localObject = ((StdDateFormat)localDateFormat1).withTimeZone(paramTimeZone);
}
else
{
DateFormat localDateFormat2 = (DateFormat)localDateFormat1.clone();
localObject = localDateFormat2;
localDateFormat2.setTimeZone(paramTimeZone);
}
ClassIntrospector localClassIntrospector = this._classIntrospector;
AnnotationIntrospector localAnnotationIntrospector = this._annotationIntrospector;
VisibilityChecker localVisibilityChecker = this._visibilityChecker;
PropertyNamingStrategy localPropertyNamingStrategy = this._propertyNamingStrategy;
TypeFactory localTypeFactory = this._typeFactory;
TypeResolverBuilder localTypeResolverBuilder = this._typeResolverBuilder;
HandlerInstantiator localHandlerInstantiator = this._handlerInstantiator;
Locale localLocale = this._locale;
Base64Variant localBase64Variant = this._defaultBase64;
return new BaseSettings(localClassIntrospector, localAnnotationIntrospector, localVisibilityChecker, localPropertyNamingStrategy, localTypeFactory, localTypeResolverBuilder, (DateFormat)localObject, localHandlerInstantiator, localLocale, paramTimeZone, localBase64Variant);
}
示例9: getDefaultVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public final VisibilityChecker<?> getDefaultVisibilityChecker()
{
VisibilityChecker localVisibilityChecker = super.getDefaultVisibilityChecker();
if (!isEnabled(MapperFeature.AUTO_DETECT_GETTERS))
localVisibilityChecker = localVisibilityChecker.withGetterVisibility(JsonAutoDetect.Visibility.NONE);
if (!isEnabled(MapperFeature.AUTO_DETECT_IS_GETTERS))
localVisibilityChecker = localVisibilityChecker.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE);
if (!isEnabled(MapperFeature.AUTO_DETECT_FIELDS))
localVisibilityChecker = localVisibilityChecker.withFieldVisibility(JsonAutoDetect.Visibility.NONE);
return localVisibilityChecker;
}
示例10: _constructDefaultValueInstantiator
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
protected ValueInstantiator _constructDefaultValueInstantiator(DeserializationContext paramDeserializationContext, BeanDescription paramBeanDescription)
{
CreatorCollector localCreatorCollector = new CreatorCollector(paramBeanDescription, paramDeserializationContext.canOverrideAccessModifiers());
AnnotationIntrospector localAnnotationIntrospector = paramDeserializationContext.getAnnotationIntrospector();
DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
VisibilityChecker localVisibilityChecker1 = localDeserializationConfig.getDefaultVisibilityChecker();
VisibilityChecker localVisibilityChecker2 = localAnnotationIntrospector.findAutoDetectVisibility(paramBeanDescription.getClassInfo(), localVisibilityChecker1);
_addDeserializerFactoryMethods(paramDeserializationContext, paramBeanDescription, localVisibilityChecker2, localAnnotationIntrospector, localCreatorCollector);
if (paramBeanDescription.getType().isConcrete())
_addDeserializerConstructors(paramDeserializationContext, paramBeanDescription, localVisibilityChecker2, localAnnotationIntrospector, localCreatorCollector);
return localCreatorCollector.constructValueInstantiator(localDeserializationConfig);
}
示例11: _handleSingleArgumentFactory
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
protected boolean _handleSingleArgumentFactory(DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, VisibilityChecker<?> paramVisibilityChecker, AnnotationIntrospector paramAnnotationIntrospector, CreatorCollector paramCreatorCollector, AnnotatedMethod paramAnnotatedMethod, boolean paramBoolean)
{
Class localClass = paramAnnotatedMethod.getRawParameterType(0);
if (localClass == String.class)
{
if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
paramCreatorCollector.addStringCreator(paramAnnotatedMethod);
return true;
}
if ((localClass == Integer.TYPE) || (localClass == Integer.class))
{
if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
paramCreatorCollector.addIntCreator(paramAnnotatedMethod);
return true;
}
if ((localClass == Long.TYPE) || (localClass == Long.class))
{
if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
paramCreatorCollector.addLongCreator(paramAnnotatedMethod);
return true;
}
if ((localClass == Double.TYPE) || (localClass == Double.class))
{
if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
paramCreatorCollector.addDoubleCreator(paramAnnotatedMethod);
return true;
}
if ((localClass == Boolean.TYPE) || (localClass == Boolean.class))
{
if ((paramBoolean) || (paramVisibilityChecker.isCreatorVisible(paramAnnotatedMethod)))
paramCreatorCollector.addBooleanCreator(paramAnnotatedMethod);
return true;
}
if (paramAnnotationIntrospector.hasCreatorAnnotation(paramAnnotatedMethod))
{
paramCreatorCollector.addDelegatingCreator(paramAnnotatedMethod, null);
return true;
}
return false;
}
示例12: getDefaultVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public final VisibilityChecker<?> getDefaultVisibilityChecker()
{
VisibilityChecker localVisibilityChecker = super.getDefaultVisibilityChecker();
if (!isEnabled(MapperFeature.AUTO_DETECT_SETTERS))
localVisibilityChecker = localVisibilityChecker.withSetterVisibility(JsonAutoDetect.Visibility.NONE);
if (!isEnabled(MapperFeature.AUTO_DETECT_CREATORS))
localVisibilityChecker = localVisibilityChecker.withCreatorVisibility(JsonAutoDetect.Visibility.NONE);
if (!isEnabled(MapperFeature.AUTO_DETECT_FIELDS))
localVisibilityChecker = localVisibilityChecker.withFieldVisibility(JsonAutoDetect.Visibility.NONE);
return localVisibilityChecker;
}
示例13: withVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
public BaseSettings withVisibilityChecker(VisibilityChecker<?> vc) {
if (_visibilityChecker == vc) {
return this;
}
return new BaseSettings(_classIntrospector, _annotationIntrospector, vc, _propertyNamingStrategy, _typeFactory,
_typeResolverBuilder, _dateFormat, _handlerInstantiator, _locale,
_timeZone, _defaultBase64);
}
示例14: getDefaultVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
@Override
public VisibilityChecker<?> getDefaultVisibilityChecker()
{
VisibilityChecker<?> vchecker = super.getDefaultVisibilityChecker();
if (!isEnabled(MapperFeature.AUTO_DETECT_SETTERS)) {
vchecker = vchecker.withSetterVisibility(Visibility.NONE);
}
if (!isEnabled(MapperFeature.AUTO_DETECT_CREATORS)) {
vchecker = vchecker.withCreatorVisibility(Visibility.NONE);
}
if (!isEnabled(MapperFeature.AUTO_DETECT_FIELDS)) {
vchecker = vchecker.withFieldVisibility(Visibility.NONE);
}
return vchecker;
}
示例15: fieldsOnlyVisibilityChecker
import com.fasterxml.jackson.databind.introspect.VisibilityChecker; //导入依赖的package包/类
private static VisibilityChecker<?> fieldsOnlyVisibilityChecker(ObjectMapper mapper) {
return mapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE);
}