Class HApiUse

java.lang.Object
org.apache.sling.hapi.sightly.HApiUse
All Implemented Interfaces:
Use

@ProviderType public class HApiUse extends Object implements Use
Sightly use class helper to provide the hypermedia API microdata attributes for the type configured throught the 'type' binding.

The type can be a JCR path or a fully qualified domain name like in HApiUtil.getTypeNode(org.apache.sling.api.resource.ResourceResolver, String)

The convenience get methods are meant to be used in the 'data-sly-attribute' in the sightly script.

  • Constructor Details

    • HApiUse

      public HApiUse()
  • Method Details

    • init

      public void init(Bindings bindings)

      Called to initialize the Java object with the current Java Scripting API bindings.

      This method is called only if the object has been instantiated by HTL as part of processing the data-sly-use attribute. The Java Scripting API bindings provide all the global variables known to a script being executed.

      Specified by:
      init in interface Use
      Parameters:
      bindings -
    • activate

      public void activate() throws Exception
      Initializes the helper and the attribute maps for the given type though the bindings
      Throws:
      Exception
    • getItemtype

      public Map<String,String> getItemtype()
      Get the itemtype html attributes map for the type
      Returns:
    • getItemprop

      public Map<String,Map<String,String>> getItemprop()
      Get the itemprop attributes map for the type, for each property. The key is the property name and the value is a map of html attributes for the property
      Returns:
    • getProptype

      public Map<String,String> getProptype()
      Get a map of the type for each property name of the type The key is the property name and the value is the type path in JCR
      Returns: