public void visitSerializableFields(Object object, ReflectionProvider.Visitor visitor) { for (Iterator iterator = fieldDictionary.fieldsFor(object.getClass()); iterator.hasNext();) { Field field = (Field) iterator.next(); if (!fieldModifiersSupported(field)) { continue; } validateFieldAccess(field); Object value = Fields.read(field, object); visitor.visit(field.getName(), field.getType(), field.getDeclaringClass(), value); } }
private Object readField(ObjectStreamField field, Class type, Object instance) { Field javaField = Fields.find(type, field.getName()); return Fields.read(javaField, instance); }
if (instanceMap != null) { try { Map map = (Map)Fields.read(instanceMap, null); if (map != null) { boolean valid = true; if(fields[i].getType() == type == Modifier.isStatic(fields[i].getModifiers())) { AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute)Fields.read(fields[i], null); attributeMap.put(toString(attribute), attribute);
public boolean add(Object object) { if (object == null) { boolean containsNull = !map.containsKey(null); map.put(null, null); return containsNull; } Class itemType = object.getClass(); if (keyFieldName != null) { Field field = (Field)fieldCache.get(itemType); if (field == null) { field = reflectionProvider.getField(itemType, keyFieldName); fieldCache.put(itemType, field); } if (field != null) { Object key = Fields.read(field, object); return map.put(key, object) == null; } } else if (object instanceof Map.Entry) { final Map.Entry entry = (Map.Entry)object; return map.put(entry.getKey(), entry.getValue()) == null; } ConversionException exception = new ConversionException("Element is not defined as entry for implicit map"); exception.add("map-type", map.getClass().getName()); exception.add("element-type", object.getClass().getName()); throw exception; }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { final Properties properties = (Properties) source; Map map = sort ? (Map)new TreeMap(properties) : (Map)properties; for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); writer.startNode("property"); writer.addAttribute("name", entry.getKey().toString()); writer.addAttribute("value", entry.getValue().toString()); writer.endNode(); } if (defaultsField != null) { Properties defaults = (Properties)Fields.read(defaultsField, properties); if (defaults != null) { writer.startNode("defaults"); marshal(defaults, writer, context); writer.endNode(); } } }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
@Override public void visitSerializableFields(final Object object, final ReflectionProvider.Visitor visitor) { for (final Iterator<Field> iterator = fieldDictionary.fieldsFor(object.getClass()); iterator.hasNext();) { final Field field = iterator.next(); if (!fieldModifiersSupported(field)) { continue; } validateFieldAccess(field); final Object value = Fields.read(field, object); visitor.visit(field.getName(), field.getType(), field.getDeclaringClass(), value); } }
@Override public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final EnumSet<?> set = (EnumSet<?>)source; final Class<?> enumTypeForSet = (Class<?>)Fields.read(typeField, set); final String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { EnumSet set = (EnumSet) source; Class enumTypeForSet = (Class) Fields.read(typeField, set); String attributeName = mapper.aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper.serializedClass(enumTypeForSet)); } writer.setValue(joinEnumValues(set)); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
@Override public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) { final Class<?> type = (Class<?>)Fields.read(typeField, source); final String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Class type = (Class) Fields.read(typeField, source); String attributeName = mapper().aliasForSystemAttribute("enum-type"); if (attributeName != null) { writer.addAttribute(attributeName, mapper().serializedClass(type)); } super.marshal(source, writer, context); }