Class ValueInspectorService<T extends GenericValue>

java.lang.Object
io.wcm.siteapi.genericedit.builder.ValueInspectorService<T>
All Implemented Interfaces:
io.wcm.sling.commons.caservice.ContextAwareService

@ConsumerType public abstract class ValueInspectorService<T extends GenericValue> extends Object implements io.wcm.sling.commons.caservice.ContextAwareService
Allows to customize the inspection process which turns properties in Sling Models instance to specific ones e.g. for links, media and rich text.
  • Field Summary

    Fields inherited from interface io.wcm.sling.commons.caservice.ContextAwareService

    PROPERTY_ACCEPTS_CONTEXT_PATH_EMPTY, PROPERTY_CONTEXT_PATH_BLACKLIST_PATTERN, PROPERTY_CONTEXT_PATH_PATTERN
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull List<T>
    inspect(@NotNull String key, @NotNull List<Object> rawValues, @NotNull Object instance)
    Inspect the value of given property to check if a specific value representation can be extracted.
    protected abstract T
    inspectValue(@NotNull String key, @NotNull Object rawValue, @NotNull Object instance)
    Inspects raw value and tries to convert it to the target type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ValueInspectorService

      public ValueInspectorService()
  • Method Details

    • inspect

      @NotNull public @NotNull List<T> inspect(@NotNull @NotNull String key, @NotNull @NotNull List<Object> rawValues, @NotNull @NotNull Object instance)
      Inspect the value of given property to check if a specific value representation can be extracted.
      Parameters:
      key - Property key
      rawValues - Raw property values
      instance - Instance property is read from for further inspection
      Returns:
      List of matching values that are found. Returns empty list if not value was found.
    • inspectValue

      @Nullable protected abstract T inspectValue(@NotNull @NotNull String key, @NotNull @NotNull Object rawValue, @NotNull @NotNull Object instance)
      Inspects raw value and tries to convert it to the target type.
      Parameters:
      key - Property key
      rawValue - Raw property value
      instance - Instance property is read from for further inspection
      Returns:
      Target type instance or null