Package org.simpleframework.xml.core
Class PrimitiveInlineList
java.lang.Object
org.simpleframework.xml.core.PrimitiveInlineList
The
PrimitiveInlineList object is used to convert a
group of elements in to a collection of element entries. This is
used when a containing element for a list is not required. It
extracts the elements by matching elements to name of the type
that the annotated field or method requires. This enables these
element entries to exist as siblings to other objects within the
object. One restriction is that the Root annotation
for each of the types within the list must be the same.
<entry>example one</entry>
<entry>example two</entry>
<entry>example three</entry>
<entry>example four</entry>
For the above XML element list the element entry is
used to wrap the primitive string value. This wrapping XML element
is configurable and defaults to the lower case string for the name
of the class it represents. So, for example, if the primitive type
is an int the enclosing element will be called int.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeThis is the type of object that will be held in the list.private final CollectionFactoryThis factory is used to create a suitable collection list.private final StringThis is the name that each list element is wrapped with.private final PrimitiveThis performs the traversal used for object serialization. -
Constructor Summary
ConstructorsConstructorDescriptionPrimitiveInlineList(Context context, Type type, Type entry, String parent) Constructor for thePrimitiveInlineListobject. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisOverridden(OutputNode node, Object value) This is used to determine whether the specified value has been overridden by the strategy.Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types.Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types.private Objectread(InputNode node, Collection list) Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types.booleanThisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types.voidwrite(OutputNode node, Object source) Thiswritemethod will write the specified object to the given XML element as as list entries.private voidwrite(OutputNode node, Object source, Mode mode) Thiswritemethod will write the specified object to the given XML element as as list entries.
-
Field Details
-
factory
This factory is used to create a suitable collection list. -
root
This performs the traversal used for object serialization. -
parent
This is the name that each list element is wrapped with. -
entry
This is the type of object that will be held in the list.
-
-
Constructor Details
-
PrimitiveInlineList
Constructor for thePrimitiveInlineListobject. This is given the list type and entry type to be used. The list type is theCollectionimplementation that is used to collect the deserialized entry objects from the XML source.- Parameters:
context- this is the context object used for serializationtype- this is the collection type for the list usedentry- the entry type to be stored within the listparent- this is the name to wrap the list element with
-
-
Method Details
-
read
Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element. -
read
Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.- Specified by:
readin interfaceConverter- Specified by:
readin interfaceRepeater- Parameters:
node- this is the XML element that is to be deserializedvalue- this is the value to read the objects in to- Returns:
- this returns the item to attach to the object contact
- Throws:
Exception- if a deserialized type cannot be instantiated
-
read
Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.- Parameters:
node- this is the XML element that is to be deserializedlist- this is the collection that is to be populated- Returns:
- this returns the item to attach to the object contact
- Throws:
Exception
-
validate
Thisreadmethod wll read the XML element list from the provided node and deserialize its children as entry types. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element. -
write
Thiswritemethod will write the specified object to the given XML element as as list entries. Each entry within the given list must be assignable to the given primitive type. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element. -
write
Thiswritemethod will write the specified object to the given XML element as as list entries. Each entry within the given list must be assignable to the given primitive type. This will deserialize each entry type as a primitive value. In order to do this the parent string provided forms the element.- Parameters:
node- this is the parent output node to write values tosource- this is the source collection to be serializedmode- this is used to determine whether to output CDATA- Throws:
Exception
-
isOverridden
This is used to determine whether the specified value has been overridden by the strategy. If the item has been overridden then no more serialization is require for that value, this is effectively telling the serialization process to stop writing.- Parameters:
node- the node that a potential override is written tovalue- this is the object instance to be serialized- Returns:
- returns true if the strategy overrides the object
- Throws:
Exception
-