Class HApiUse

  • All Implemented Interfaces:
    Use

    @ProviderType
    public class HApiUse
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      HApiUse()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activate()
      Initializes the helper and the attribute maps for the given type though the bindings
      java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> getItemprop()
      Get the itemprop attributes map for the type, for each property.
      java.util.Map<java.lang.String,​java.lang.String> getItemtype()
      Get the itemtype html attributes map for the type
      java.util.Map<java.lang.String,​java.lang.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
      void init​(javax.script.Bindings bindings)
      Called to initialize the Java object with the current Java Scripting API bindings.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HApiUse

        public HApiUse()
    • Method Detail

      • init

        public void init​(javax.script.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 java.lang.Exception
        Initializes the helper and the attribute maps for the given type though the bindings
        Throws:
        java.lang.Exception
      • getItemtype

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

        public java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.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 java.util.Map<java.lang.String,​java.lang.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: