本文整理汇总了Java中org.codehaus.jackson.map.util.EnumValues类的典型用法代码示例。如果您正苦于以下问题:Java EnumValues类的具体用法?Java EnumValues怎么用?Java EnumValues使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnumValues类属于org.codehaus.jackson.map.util包,在下文中一共展示了EnumValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EnumMapSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的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;
}
示例2: serializeContentsUsing
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected void serializeContentsUsing(EnumMap<? extends Enum<?>,?> value, JsonGenerator jgen, SerializerProvider provider,
JsonSerializer<Object> valueSer)
throws IOException, JsonGenerationException
{
EnumValues keyEnums = _keyEnums;
for (Map.Entry<? extends Enum<?>,?> entry : value.entrySet()) {
Enum<?> key = entry.getKey();
if (keyEnums == null) {
// clumsy, but has to do for now:
SerializerBase<?> ser = (SerializerBase<?>) provider.findValueSerializer(key.getDeclaringClass());
keyEnums = ((EnumSerializer) ser).getEnumValues();
}
jgen.writeFieldName(keyEnums.valueFor(key));
Object valueElem = entry.getValue();
if (valueElem == null) {
provider.getNullValueSerializer().serialize(null, jgen, provider);
} else {
try {
valueSer.serialize(valueElem, jgen, provider);
} catch (Exception e) {
wrapAndThrow(e, value, entry.getKey().name());
}
}
}
}
示例3: buildEnumMapSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected JsonSerializer<?> buildEnumMapSerializer(JavaType type, SerializationConfig config,
BasicBeanDescription beanDesc)
{
JavaType keyType = type.getKeyType();
JavaType valueType = type.getContentType();
// Need to find key enum values...
EnumValues enums = null;
if (keyType.isEnumType()) { // non-enum if we got it as type erased class (from instance)
@SuppressWarnings("unchecked")
Class<Enum<?>> enumClass = (Class<Enum<?>>) keyType.getRawClass();
enums = EnumValues.construct(enumClass, config.getAnnotationIntrospector());
}
TypeSerializer typeSer = createTypeSerializer(valueType, config);
return new EnumMapSerializer(valueType, usesStaticTyping(config, beanDesc),
enums, typeSer);
}
示例4: serializeContentsUsing
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected void serializeContentsUsing(EnumMap<? extends Enum<?>, ?> paramEnumMap, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, JsonSerializer<Object> paramJsonSerializer)
{
EnumValues localEnumValues1 = this._keyEnums;
Iterator localIterator = paramEnumMap.entrySet().iterator();
EnumValues localEnumValues2 = localEnumValues1;
while (localIterator.hasNext())
{
Map.Entry localEntry = (Map.Entry)localIterator.next();
Enum localEnum = (Enum)localEntry.getKey();
if (localEnumValues2 == null)
localEnumValues2 = ((EnumSerializer)paramSerializerProvider.findValueSerializer(localEnum.getDeclaringClass(), this._property)).getEnumValues();
paramJsonGenerator.writeFieldName(localEnumValues2.serializedValueFor(localEnum));
Object localObject = localEntry.getValue();
if (localObject == null)
paramSerializerProvider.defaultSerializeNull(paramJsonGenerator);
else
try
{
paramJsonSerializer.serialize(localObject, paramJsonGenerator, paramSerializerProvider);
}
catch (Exception localException)
{
wrapAndThrow(paramSerializerProvider, localException, paramEnumMap, ((Enum)localEntry.getKey()).name());
}
}
}
示例5: construct
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public static EnumSerializer construct(Class<Enum<?>> paramClass, SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription)
{
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.WRITE_ENUMS_USING_TO_STRING));
for (EnumValues localEnumValues = EnumValues.constructFromToString(paramClass, localAnnotationIntrospector); ; localEnumValues = EnumValues.constructFromName(paramClass, localAnnotationIntrospector))
return new EnumSerializer(localEnumValues);
}
示例6: serializeContentsUsing
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected void serializeContentsUsing(EnumMap<? extends Enum<?>, ?> paramEnumMap, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, JsonSerializer<Object> paramJsonSerializer)
throws IOException, JsonGenerationException
{
EnumValues localEnumValues = this._keyEnums;
Iterator localIterator = paramEnumMap.entrySet().iterator();
while (localIterator.hasNext())
{
Map.Entry localEntry = (Map.Entry)localIterator.next();
Enum localEnum = (Enum)localEntry.getKey();
if (localEnumValues == null)
localEnumValues = ((EnumSerializer)(SerializerBase)paramSerializerProvider.findValueSerializer(localEnum.getDeclaringClass(), this._property)).getEnumValues();
paramJsonGenerator.writeFieldName(localEnumValues.serializedValueFor(localEnum));
Object localObject = localEntry.getValue();
if (localObject == null)
{
paramSerializerProvider.defaultSerializeNull(paramJsonGenerator);
continue;
}
try
{
paramJsonSerializer.serialize(localObject, paramJsonGenerator, paramSerializerProvider);
}
catch (Exception localException)
{
wrapAndThrow(paramSerializerProvider, localException, paramEnumMap, ((Enum)localEntry.getKey()).name());
}
}
}
示例7: buildEnumMapSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected JsonSerializer<?> buildEnumMapSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType, BasicBeanDescription paramBasicBeanDescription, BeanProperty paramBeanProperty, boolean paramBoolean, TypeSerializer paramTypeSerializer, JsonSerializer<Object> paramJsonSerializer)
{
JavaType localJavaType = paramJavaType.getKeyType();
boolean bool = localJavaType.isEnumType();
EnumValues localEnumValues = null;
if (bool)
localEnumValues = EnumValues.construct(localJavaType.getRawClass(), paramSerializationConfig.getAnnotationIntrospector());
return new EnumMapSerializer(paramJavaType.getContentType(), paramBoolean, localEnumValues, paramTypeSerializer, paramBeanProperty, paramJsonSerializer);
}
示例8: EnumMapSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public EnumMapSerializer(JavaType valueType, boolean staticTyping, EnumValues keyEnums,
TypeSerializer vts)
{
super(EnumMap.class, false);
_staticTyping = staticTyping || (valueType != null && valueType.isFinal());
_valueType = valueType;
_keyEnums = keyEnums;
_valueTypeSerializer = vts;
}
示例9: EnumSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public EnumSerializer(EnumValues paramEnumValues)
{
super(Enum.class, false);
this._values = paramEnumValues;
}
示例10: getEnumValues
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public EnumValues getEnumValues()
{
return this._values;
}
示例11: EnumSerializer
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public EnumSerializer(EnumValues v) {
super(Enum.class, false);
_values = v;
}
示例12: construct
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public static EnumSerializer construct(Class<Enum<?>> enumClass, AnnotationIntrospector intr)
{
return new EnumSerializer(EnumValues.construct(enumClass, intr));
}
示例13: serializeContents
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected void serializeContents(EnumMap<? extends Enum<?>,?> value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
if (_valueSerializer != null) {
serializeContentsUsing(value, jgen, provider, _valueSerializer);
return;
}
JsonSerializer<Object> prevSerializer = null;
Class<?> prevClass = null;
EnumValues keyEnums = _keyEnums;
for (Map.Entry<? extends Enum<?>,?> entry : value.entrySet()) {
// First, serialize key
Enum<?> key = entry.getKey();
if (keyEnums == null) {
/* 15-Oct-2009, tatu: This is clumsy, but still the simplest efficient
* way to do it currently, as Serializers get cached. (it does assume we'll always use
* default serializer tho -- so ideally code should be rewritten)
*/
// ... and lovely two-step casting process too...
SerializerBase<?> ser = (SerializerBase<?>) provider.findValueSerializer(key.getDeclaringClass());
keyEnums = ((EnumSerializer) ser).getEnumValues();
}
jgen.writeFieldName(keyEnums.valueFor(key));
// And then value
Object valueElem = entry.getValue();
if (valueElem == null) {
provider.getNullValueSerializer().serialize(null, jgen, provider);
} else {
Class<?> cc = valueElem.getClass();
JsonSerializer<Object> currSerializer;
if (cc == prevClass) {
currSerializer = prevSerializer;
} else {
currSerializer = provider.findValueSerializer(cc);
prevSerializer = currSerializer;
prevClass = cc;
}
try {
currSerializer.serialize(valueElem, jgen, provider);
} catch (Exception e) {
// [JACKSON-55] Need to add reference information
wrapAndThrow(e, value, entry.getKey().name());
}
}
}
}
示例14: serializeContents
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
protected void serializeContents(EnumMap<? extends Enum<?>, ?> paramEnumMap, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
{
if (this._valueSerializer != null)
serializeContentsUsing(paramEnumMap, paramJsonGenerator, paramSerializerProvider, this._valueSerializer);
while (true)
{
return;
EnumValues localEnumValues1 = this._keyEnums;
Iterator localIterator = paramEnumMap.entrySet().iterator();
EnumValues localEnumValues2 = localEnumValues1;
Object localObject1 = null;
Object localObject2 = null;
while (localIterator.hasNext())
{
Map.Entry localEntry = (Map.Entry)localIterator.next();
Enum localEnum = (Enum)localEntry.getKey();
if (localEnumValues2 == null)
localEnumValues2 = ((EnumSerializer)paramSerializerProvider.findValueSerializer(localEnum.getDeclaringClass(), this._property)).getEnumValues();
paramJsonGenerator.writeFieldName(localEnumValues2.serializedValueFor(localEnum));
Object localObject3 = localEntry.getValue();
if (localObject3 == null)
{
paramSerializerProvider.defaultSerializeNull(paramJsonGenerator);
}
else
{
Object localObject4 = localObject3.getClass();
Object localObject5;
if (localObject4 == localObject1)
{
localObject4 = localObject1;
localObject5 = localObject2;
}
try
{
while (true)
{
((JsonSerializer)localObject2).serialize(localObject3, paramJsonGenerator, paramSerializerProvider);
localObject2 = localObject5;
localObject1 = localObject4;
break;
localObject2 = paramSerializerProvider.findValueSerializer((Class)localObject4, this._property);
localObject5 = localObject2;
}
}
catch (Exception localException)
{
wrapAndThrow(paramSerializerProvider, localException, paramEnumMap, ((Enum)localEntry.getKey()).name());
localObject2 = localObject5;
localObject1 = localObject4;
}
}
}
}
}
示例15: getEnumValues
import org.codehaus.jackson.map.util.EnumValues; //导入依赖的package包/类
public EnumValues getEnumValues() { return _values; }