Class PrismParserImplIO
- java.lang.Object
 - 
- com.evolveum.midpoint.prism.impl.marshaller.PrismParserImplIO
 
 
- 
- All Implemented Interfaces:
 PrismParser
public class PrismParserImplIO extends Object
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface com.evolveum.midpoint.prism.PrismParser
PrismParser.ObjectHandler 
 - 
 
- 
Constructor Summary
Constructors Constructor Description PrismParserImplIO(ParserSource source, String language, ParsingContext context, PrismContextImpl prismContext, ItemDefinition<?> itemDefinition, QName itemName, QName typeName, Class<?> typeClass) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull PrismParsercompat()Switches the parser into "compatibility" (or relaxed) parsing mode.@NotNull PrismParsercontext(@NotNull ParsingContext context)Provides a parsing context for the parser.PrismParserconvertMissingTypes()@NotNull PrismParserdefinition(ItemDefinition<?> itemDefinition)Tells parser which definition to use when parsing item (or an item value).@NotNull PrismParserjson()Sets the language of the parser to be JSON.@NotNull PrismParserlanguage(@Nullable String language)For string inputs: sets the data language that the parser will try to parse; null means auto-detect.@NotNull PrismParsername(QName itemName)Tells parser what name to use for parsed item.<O extends Objectable>
@NotNull PrismObject<O>parse()Parses the input as a prism object.<IV extends PrismValue,ID extends ItemDefinition>
Item<IV,ID>parseItem()Parses the input as a prism item.ObjectparseItemOrRealValue()Parses either an item, or a real value.<IV extends PrismValue>
IVparseItemValue()Parses the input as a prism value.@NotNull List<PrismObject<? extends Objectable>>parseObjects()Parses the input as a collection of prism objects.voidparseObjectsIteratively(@NotNull PrismParser.ObjectHandler handler)Currently implemented for JSON/YAML only.<T> TparseRealValue()Parses a real value.<T> TparseRealValue(Class<T> clazz)Parses a real value - either property or container value.<T> javax.xml.bind.JAXBElement<T>parseRealValueToJaxbElement()Parses a real value and stores it into JAXBElement, using item name derived in the usual way.RootXNodeImplparseToXNode()Parses the input into RootXNode.@NotNull PrismParserstrict()Switches the parser into "strict" parsing mode.@NotNull PrismParsertype(Class<?> typeClass)Tells parser what data type to expect.@NotNull PrismParsertype(QName typeName)Tells parser what data type to expect.@NotNull PrismParserxml()Sets the language of the parser to be XML.@NotNull PrismParseryaml()Sets the language of the parser to be YAML. 
 - 
 
- 
- 
Constructor Detail
- 
PrismParserImplIO
public PrismParserImplIO(ParserSource source, String language, ParsingContext context, PrismContextImpl prismContext, ItemDefinition<?> itemDefinition, QName itemName, QName typeName, Class<?> typeClass)
 
 - 
 
- 
Method Detail
- 
parse
@NotNull public <O extends Objectable> @NotNull PrismObject<O> parse() throws SchemaException, IOException
Description copied from interface:PrismParserParses the input as a prism object.- Returns:
 - The object.
 - Throws:
 SchemaExceptionIOException
 
- 
parseItem
public <IV extends PrismValue,ID extends ItemDefinition> Item<IV,ID> parseItem() throws SchemaException, IOException
Description copied from interface:PrismParserParses the input as a prism item. (Object, container, reference, value.) May return raw property values as part of the prism structure, if definitions are not known.- Returns:
 - The item.
 - Throws:
 SchemaExceptionIOException
 
- 
parseItemValue
public <IV extends PrismValue> IV parseItemValue() throws SchemaException, IOException
Description copied from interface:PrismParserParses the input as a prism value. (Container value, reference value, property value.) May return raw property values as part of the prism structure, if definitions are not known.- Returns:
 - The item.
 - Throws:
 SchemaExceptionIOException
 
- 
parseRealValue
public <T> T parseRealValue(Class<T> clazz) throws IOException, SchemaException
Description copied from interface:PrismParserParses a real value - either property or container value.- Parameters:
 clazz- Expected class of the data. May be null if unknown.- Returns:
 - Real value - POJO, Containerable, Objectable or Referencable.
 - Throws:
 IOExceptionSchemaException
 
- 
parseRealValue
public <T> T parseRealValue() throws IOException, SchemaExceptionDescription copied from interface:PrismParserParses a real value. The class is not supplied by the caller, so it has to be determined from the data source.- Returns:
 - Real value - POJO, Containerable, Objectable or Referencable.
 - Throws:
 IOExceptionSchemaException
 
- 
parseRealValueToJaxbElement
public <T> javax.xml.bind.JAXBElement<T> parseRealValueToJaxbElement() throws IOException, SchemaExceptionDescription copied from interface:PrismParserParses a real value and stores it into JAXBElement, using item name derived in the usual way.- Throws:
 IOExceptionSchemaException
 
- 
parseToXNode
public RootXNodeImpl parseToXNode() throws IOException, SchemaException
Description copied from interface:PrismParserParses the input into RootXNode. This is a bit unusual approach, skipping the unmarshalling phase altogether. But it is useful at some places.- Returns:
 - RootXNode corresponding to the input.
 - Throws:
 IOExceptionSchemaException
 
- 
parseObjects
@NotNull public @NotNull List<PrismObject<? extends Objectable>> parseObjects() throws SchemaException, IOException
Description copied from interface:PrismParserParses the input as a collection of prism objects. For XML the input must be formatted as a collection of objects (TODO change this). For other languages the input may contain one or more objects.- Returns:
 - A list of objects.
 - Throws:
 SchemaExceptionIOException
 
- 
parseObjectsIteratively
public void parseObjectsIteratively(@NotNull @NotNull PrismParser.ObjectHandler handler) throws SchemaException, IOExceptionDescription copied from interface:PrismParserCurrently implemented for JSON/YAML only. For XML, use old Validator code.- Throws:
 SchemaExceptionIOException
 
- 
parseItemOrRealValue
public Object parseItemOrRealValue() throws IOException, SchemaException
Description copied from interface:PrismParserParses either an item, or a real value. It depends on the type declaration or item name in the source data. 1) If explicit type is present, it is taken into account. If it corresponds to a prism item, the input is parsed as a prism item. Otherwise, it is parsed as a real value (containerable or simple POJO), if possible. 2) If there is no type, the item name is consulted. If it corresponds to a prism item, the input is parsed as a prism item. Otherwise, an exception is thrown. Pre-set parameters (itemDefinition, typeName, itemName) must NOT be present. Use with utmost care. If at all possible, avoid it.- Returns:
 - either prism item (Item) or a real value (Object)
 - Throws:
 IOExceptionSchemaException
 
- 
language
@NotNull public @NotNull PrismParser language(@Nullable @Nullable String language)
Description copied from interface:PrismParserFor string inputs: sets the data language that the parser will try to parse; null means auto-detect. For other kinds of input (DOM and XNode) the language is fixed to XML or none, respectively.- Specified by:
 languagein interfacePrismParser- Parameters:
 language- The language- Returns:
 - Updated parser.
 
 
- 
xml
@NotNull public @NotNull PrismParser xml()
Description copied from interface:PrismParserSets the language of the parser to be XML.- Specified by:
 xmlin interfacePrismParser- Returns:
 - Updated parser.
 
 
- 
json
@NotNull public @NotNull PrismParser json()
Description copied from interface:PrismParserSets the language of the parser to be JSON.- Specified by:
 jsonin interfacePrismParser- Returns:
 - Updated parser.
 
 
- 
yaml
@NotNull public @NotNull PrismParser yaml()
Description copied from interface:PrismParserSets the language of the parser to be YAML.- Specified by:
 yamlin interfacePrismParser- Returns:
 - Updated parser.
 
 
- 
context
@NotNull public @NotNull PrismParser context(@NotNull @NotNull ParsingContext context)
Description copied from interface:PrismParserProvides a parsing context for the parser. The context contains e.g. selection of strict/compat mode of operation (set by client) or a list of warnings (maintained by the parser).- Specified by:
 contextin interfacePrismParser- Parameters:
 context- The parsing context.- Returns:
 - Updated parser.
 
 
- 
strict
@NotNull public @NotNull PrismParser strict()
Description copied from interface:PrismParserSwitches the parser into "strict" parsing mode.- Specified by:
 strictin interfacePrismParser- Returns:
 - Updated parser.
 
 
- 
compat
@NotNull public @NotNull PrismParser compat()
Description copied from interface:PrismParserSwitches the parser into "compatibility" (or relaxed) parsing mode. TODO description here- Specified by:
 compatin interfacePrismParser- Returns:
 - Updated parser.
 
 
- 
convertMissingTypes
public PrismParser convertMissingTypes()
- Specified by:
 convertMissingTypesin interfacePrismParser
 
- 
definition
@NotNull public @NotNull PrismParser definition(ItemDefinition<?> itemDefinition)
Description copied from interface:PrismParserTells parser which definition to use when parsing item (or an item value). Optional.- Specified by:
 definitionin interfacePrismParser- Parameters:
 itemDefinition- The definition- Returns:
 - Updated parser.
 
 
- 
name
@NotNull public @NotNull PrismParser name(QName itemName)
Description copied from interface:PrismParserTells parser what name to use for parsed item. Optional.- Specified by:
 namein interfacePrismParser- Parameters:
 itemName- Item name to use.- Returns:
 - Updated parser.
 
 
- 
type
@NotNull public @NotNull PrismParser type(QName typeName)
Description copied from interface:PrismParserTells parser what data type to expect. Optional.- Specified by:
 typein interfacePrismParser- Parameters:
 typeName- Data type to expect.- Returns:
 - Updated parser.
 
 
- 
type
@NotNull public @NotNull PrismParser type(Class<?> typeClass)
Description copied from interface:PrismParserTells parser what data type to expect. Optional.- Specified by:
 typein interfacePrismParser- Parameters:
 typeClass- Data type to expect.- Returns:
 - Updated parser.
 
 
 - 
 
 -