Interface DefinitionFeatureParser<V,S>

Type Parameters:
V - feature value
S - source object (like XSOM component, annotation, and so on)
All Known Subinterfaces:
DefinitionFeatureParser.Marker<X>, DefinitionFeatureParser.NonNull<V,X>

public interface DefinitionFeatureParser<V,S>
Parses a schema definition feature value from the source form (currently, XSD/XSOM) to the real value. Most of these are annotations: For example, "a:container" annotation is converted to a Boolean value. However, more complex features are possible, such as "isAny" feature that is determined by analyzing the complex type definition, and produces a tri-state information about the presence and kind of "any" content present.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Special parser for "marker" boolean values, like `a:container`.
    static interface 
    Marks the parser as always returning a value, and provides appropriate getter method.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    applicableTo(Object sourceComponent)
     
    getValue(S source)
    Returns the value of the definition feature for the given (usually XSOM) source.
    default V
    getValueIfApplicable(@NotNull Object source)
     
    default <RS> @NotNull DefinitionFeatureParser<V,RS>
    restrictToSource(Class<RS> restrictedSourceType)
    Returns this parser, but restricted to a more specific source type.
  • Method Details

    • getValue

      @Nullable V getValue(@Nullable S source) throws SchemaException
      Returns the value of the definition feature for the given (usually XSOM) source. The source is intentionally nullable, because there are situations where this method is called with annotations that are often missing.
      Throws:
      SchemaException
    • getValueIfApplicable

      @Nullable default V getValueIfApplicable(@NotNull @NotNull Object source) throws SchemaException
      Throws:
      SchemaException
    • applicableTo

      default boolean applicableTo(Object sourceComponent)
    • restrictToSource

      @NotNull default <RS> @NotNull DefinitionFeatureParser<V,RS> restrictToSource(Class<RS> restrictedSourceType)
      Returns this parser, but restricted to a more specific source type. For example, if original parser takes any Object (e.g., `XSComponent` or `XSAnnotation`), we may restrict it to take only `XSAnnotation`. This is useful e.g. for annotation-based features.