本文整理汇总了Java中org.codehaus.jackson.map.JsonSerializer类的典型用法代码示例。如果您正苦于以下问题:Java JsonSerializer类的具体用法?Java JsonSerializer怎么用?Java JsonSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonSerializer类属于org.codehaus.jackson.map包,在下文中一共展示了JsonSerializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _findInterfaceMapping
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
protected JsonSerializer<?> _findInterfaceMapping(Class<?> paramClass, ClassKey paramClassKey)
{
for (Class localClass : paramClass.getInterfaces())
{
paramClassKey.reset(localClass);
JsonSerializer localJsonSerializer = (JsonSerializer)this._interfaceMappings.get(paramClassKey);
if (localJsonSerializer != null);
do
{
return localJsonSerializer;
localJsonSerializer = _findInterfaceMapping(localClass, paramClassKey);
}
while (localJsonSerializer != null);
}
return null;
}
示例2: buildCollectionSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
protected JsonSerializer<?> buildCollectionSerializer(SerializationConfig paramSerializationConfig, CollectionType paramCollectionType, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty, boolean paramBoolean, TypeSerializer paramTypeSerializer, JsonSerializer<Object> paramJsonSerializer)
{
Iterator localIterator = customSerializers().iterator();
while (localIterator.hasNext())
{
JsonSerializer localJsonSerializer = ((Serializers)localIterator.next()).findCollectionSerializer(paramSerializationConfig, paramCollectionType, paramBasicBeanDescription, paramBeanProperty, paramTypeSerializer, paramJsonSerializer);
if (localJsonSerializer != null)
return localJsonSerializer;
}
Class localClass1 = paramCollectionType.getRawClass();
if (EnumSet.class.isAssignableFrom(localClass1))
return buildEnumSetSerializer(paramSerializationConfig, paramCollectionType, paramBasicBeanDescription, paramBeanProperty, paramBoolean, paramTypeSerializer, paramJsonSerializer);
Class localClass2 = paramCollectionType.getContentType().getRawClass();
if (isIndexedList(localClass1))
{
if (localClass2 == String.class)
return new IndexedStringListSerializer(paramBeanProperty);
return ContainerSerializers.indexedListSerializer(paramCollectionType.getContentType(), paramBoolean, paramTypeSerializer, paramBeanProperty, paramJsonSerializer);
}
if (localClass2 == String.class)
return new StringCollectionSerializer(paramBeanProperty);
return ContainerSerializers.collectionSerializer(paramCollectionType.getContentType(), paramBoolean, paramTypeSerializer, paramBeanProperty, paramJsonSerializer);
}
示例3: findBeanSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public JsonSerializer<Object> findBeanSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty)
throws JsonMappingException
{
JsonSerializer localJsonSerializer;
if (!isPotentialBeanType(paramJavaType.getRawClass()))
localJsonSerializer = null;
while (true)
{
return localJsonSerializer;
localJsonSerializer = constructBeanSerializer(paramSerializationConfig, paramBasicBeanDescription, paramBeanProperty);
if (!this._factoryConfig.hasSerializerModifiers())
continue;
Iterator localIterator = this._factoryConfig.serializerModifiers().iterator();
while (localIterator.hasNext())
localJsonSerializer = ((BeanSerializerModifier)localIterator.next()).modifySerializer(paramSerializationConfig, paramBasicBeanDescription, localJsonSerializer);
}
}
示例4: AsArraySerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
protected AsArraySerializer(Class<?> paramClass, JavaType paramJavaType, boolean paramBoolean, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty, JsonSerializer<Object> paramJsonSerializer)
{
super(false);
this._elementType = paramJavaType;
boolean bool1;
if (!paramBoolean)
{
bool1 = false;
if (paramJavaType != null)
{
boolean bool2 = paramJavaType.isFinal();
bool1 = false;
if (!bool2);
}
}
else
{
bool1 = true;
}
this._staticTyping = bool1;
this._valueTypeSerializer = paramTypeSerializer;
this._property = paramBeanProperty;
this._elementSerializer = paramJsonSerializer;
this._dynamicSerializers = PropertySerializerMap.emptyMap();
}
示例5: construct
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public static MapSerializer construct(String[] paramArrayOfString, JavaType paramJavaType, boolean paramBoolean, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty, JsonSerializer<Object> paramJsonSerializer1, JsonSerializer<Object> paramJsonSerializer2)
{
HashSet localHashSet = toSet(paramArrayOfString);
JavaType localJavaType2;
JavaType localJavaType1;
if (paramJavaType == null)
{
localJavaType2 = UNSPECIFIED_TYPE;
localJavaType1 = localJavaType2;
if (!paramBoolean)
if ((localJavaType2 == null) || (!localJavaType2.isFinal()))
break label75;
}
label75: for (paramBoolean = true; ; paramBoolean = false)
{
return new MapSerializer(localHashSet, localJavaType1, localJavaType2, paramBoolean, paramTypeSerializer, paramJsonSerializer1, paramJsonSerializer2, paramBeanProperty);
localJavaType1 = paramJavaType.getKeyType();
localJavaType2 = paramJavaType.getContentType();
break;
}
}
示例6: _findExplicitUntypedSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
protected JsonSerializer<Object> _findExplicitUntypedSerializer(Class<?> paramClass, BeanProperty paramBeanProperty)
{
JsonSerializer localJsonSerializer1 = this._knownSerializers.untypedValueSerializer(paramClass);
if (localJsonSerializer1 != null)
return localJsonSerializer1;
JsonSerializer localJsonSerializer2 = this._serializerCache.untypedValueSerializer(paramClass);
if (localJsonSerializer2 != null)
return localJsonSerializer2;
try
{
JsonSerializer localJsonSerializer3 = _createAndCacheUntypedSerializer(paramClass, paramBeanProperty);
return localJsonSerializer3;
}
catch (Exception localException)
{
}
return null;
}
示例7: findTypedValueSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public JsonSerializer<Object> findTypedValueSerializer(Class<?> paramClass, boolean paramBoolean, BeanProperty paramBeanProperty)
throws JsonMappingException
{
JsonSerializer localJsonSerializer1 = this._knownSerializers.typedValueSerializer(paramClass);
if (localJsonSerializer1 != null)
return localJsonSerializer1;
JsonSerializer localJsonSerializer2 = this._serializerCache.typedValueSerializer(paramClass);
if (localJsonSerializer2 != null)
return localJsonSerializer2;
Object localObject = findValueSerializer(paramClass, paramBeanProperty);
TypeSerializer localTypeSerializer = this._serializerFactory.createTypeSerializer(this._config, this._config.constructType(paramClass), paramBeanProperty);
if (localTypeSerializer != null)
localObject = new WrappedSerializer(localTypeSerializer, (JsonSerializer)localObject);
if (paramBoolean)
this._serializerCache.addTypedSerializer(paramClass, (JsonSerializer)localObject);
return (JsonSerializer<Object>)localObject;
}
示例8: findValueSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public JsonSerializer<Object> findValueSerializer(Class<?> paramClass, BeanProperty paramBeanProperty)
throws JsonMappingException
{
JsonSerializer localJsonSerializer = this._knownSerializers.untypedValueSerializer(paramClass);
if (localJsonSerializer == null)
{
localJsonSerializer = this._serializerCache.untypedValueSerializer(paramClass);
if (localJsonSerializer == null)
{
localJsonSerializer = this._serializerCache.untypedValueSerializer(this._config.constructType(paramClass));
if (localJsonSerializer == null)
{
localJsonSerializer = _createAndCacheUntypedSerializer(paramClass, paramBeanProperty);
if (localJsonSerializer == null)
return getUnknownTypeSerializer(paramClass);
}
}
}
if ((localJsonSerializer instanceof ContextualSerializer))
return ((ContextualSerializer)localJsonSerializer).createContextual(this._config, paramBeanProperty);
return localJsonSerializer;
}
示例9: addAndResolveNonTypedSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public void addAndResolveNonTypedSerializer(Class<?> paramClass, JsonSerializer<Object> paramJsonSerializer, SerializerProvider paramSerializerProvider)
throws JsonMappingException
{
monitorenter;
try
{
if (this._sharedMap.put(new TypeKey(paramClass, false), paramJsonSerializer) == null)
this._readOnlyMap = null;
if ((paramJsonSerializer instanceof ResolvableSerializer))
((ResolvableSerializer)paramJsonSerializer).resolve(paramSerializerProvider);
return;
}
finally
{
monitorexit;
}
throw localObject;
}
示例10: BeanPropertyWriter
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public BeanPropertyWriter(AnnotatedMember paramAnnotatedMember, Annotations paramAnnotations, SerializedString paramSerializedString, JavaType paramJavaType1, JsonSerializer<Object> paramJsonSerializer, TypeSerializer paramTypeSerializer, JavaType paramJavaType2, Method paramMethod, Field paramField, boolean paramBoolean, Object paramObject)
{
this._member = paramAnnotatedMember;
this._contextAnnotations = paramAnnotations;
this._name = paramSerializedString;
this._declaredType = paramJavaType1;
this._serializer = paramJsonSerializer;
if (paramJsonSerializer == null);
for (PropertySerializerMap localPropertySerializerMap = PropertySerializerMap.emptyMap(); ; localPropertySerializerMap = null)
{
this._dynamicSerializers = localPropertySerializerMap;
this._typeSerializer = paramTypeSerializer;
this._cfgSerializationType = paramJavaType2;
this._accessorMethod = paramMethod;
this._field = paramField;
this._suppressNulls = paramBoolean;
this._suppressableValue = paramObject;
return;
}
}
示例11: findSerializerByLookup
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public final JsonSerializer<?> findSerializerByLookup(JavaType paramJavaType, SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty, boolean paramBoolean)
{
String str = paramJavaType.getRawClass().getName();
JsonSerializer localJsonSerializer1 = (JsonSerializer)_concrete.get(str);
if (localJsonSerializer1 != null)
return localJsonSerializer1;
Class localClass = (Class)_concreteLazy.get(str);
if (localClass != null)
try
{
JsonSerializer localJsonSerializer2 = (JsonSerializer)localClass.newInstance();
return localJsonSerializer2;
}
catch (Exception localException)
{
throw new IllegalStateException("Failed to instantiate standard serializer (of type " + localClass.getName() + "): " + localException.getMessage(), localException);
}
return null;
}
示例12: EnumMapSerializer
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public EnumMapSerializer(JavaType paramJavaType, boolean paramBoolean, EnumValues paramEnumValues, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty, JsonSerializer<Object> paramJsonSerializer)
{
super(EnumMap.class, false);
boolean bool1;
if (!paramBoolean)
{
bool1 = false;
if (paramJavaType != null)
{
boolean bool2 = paramJavaType.isFinal();
bool1 = false;
if (!bool2);
}
}
else
{
bool1 = true;
}
this._staticTyping = bool1;
this._valueType = paramJavaType;
this._keyEnums = paramEnumValues;
this._valueTypeSerializer = paramTypeSerializer;
this._property = paramBeanProperty;
this._valueSerializer = paramJsonSerializer;
}
示例13: find
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
public JsonSerializer<Object> find(SerializerCache.TypeKey paramTypeKey)
{
int i = paramTypeKey.hashCode() & -1 + this._buckets.length;
Bucket localBucket = this._buckets[i];
if (localBucket == null)
return null;
if (paramTypeKey.equals(localBucket.key))
return localBucket.value;
do
{
localBucket = localBucket.next;
if (localBucket == null)
break;
}
while (!paramTypeKey.equals(localBucket.key));
return localBucket.value;
}
示例14: addJodaSerializers
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
/** Add Joda-Time serializers to a module. */
@SuppressWarnings({
"unchecked",
"rawtypes"
})
private static void addJodaSerializers(final SimpleModule module) {
for (final Entry<Class<?>, JsonSerializer<?>> serializer : new JodaSerializers().provide()) {
module.addSerializer((Class) serializer.getKey(), serializer.getValue());
}
module.addSerializer(Duration.class, DurationSerializer.create());
module.addSerializer(Instant.class, InstantSerializer.create());
module.addSerializer(Interval.class, IntervalSerializer.create());
module.addSerializer(LocalDate.class, LocalDateSerializer.create());
}
示例15: filterInputClasses
import org.codehaus.jackson.map.JsonSerializer; //导入依赖的package包/类
private Set<Class<?>> filterInputClasses(Set<Class<?>> referencedClasses) {
Set<Class<?>> typesToUse = Sets.newHashSet();
for (Class<?> beanClass : referencedClasses) {
if (beanClass.isEnum()) {
typesToUse.add(beanClass);
continue;
}
if (beanClass.equals(void.class)) {
continue;
}
if (beanClass instanceof Class && beanClass.isEnum()) {
typesToUse.add(beanClass);
continue;
}
if (beanClass == URI.class) {
continue;
}
// Classes directly passed in to typescript-generator need to be directly serializable, so filter out the ones that serializers
// exist for.
SerializationConfig serializationConfig = OBJECT_MAPPER.getSerializationConfig();
final JavaType simpleType = OBJECT_MAPPER.constructType(beanClass);
try {
final JsonSerializer<?> jsonSerializer = BeanSerializerFactory.instance.createSerializer(serializationConfig, simpleType, null);
if (jsonSerializer == null || jsonSerializer instanceof BeanSerializer) {
typesToUse.add(beanClass);
}
} catch(Exception e) {
}
}
return typesToUse;
}