Interface NCMetadata

    • Method Detail

      • metaOpt

        default <T> Optional<T> metaOpt​(String prop)
        Shortcut method to get given optional metadata property. Equivalent to:
              Optional.ofNullable((T)getMetadata().get(prop));
         
        Type Parameters:
        T - Type of the metadata property.
        Parameters:
        prop - Metadata property name.
        Returns:
        Metadata optional property value.
      • meta

        default <T> T meta​(String prop)
        Shortcut method to get given metadata property. Equivalent to:
              (T)getMetadata().get(prop);
         
        Type Parameters:
        T - Type of the metadata property.
        Parameters:
        prop - Metadata property name.
        Returns:
        Metadata property value or null if given metadata property not found.
      • metax

        default <T> T metax​(String prop)
                     throws org.apache.nlpcraft.common.NCException
        Shortcut method to get given mandatory metadata property. Equivalent to:
             T t = (T)getMetadata().get(prop);
             if (t == null)
                 throw new NCException("Mandatory metadata property not found: " + prop);
             else
                 return t;
         
        Type Parameters:
        T - Type of the metadata property.
        Parameters:
        prop - Metadata property name.
        Returns:
        Metadata property value or throws an exception if given metadata property not found.
        Throws:
        org.apache.nlpcraft.common.NCException - Thrown if given metadata property not found.
      • meta

        default <T> T meta​(String prop,
                           T dflt)
        Shortcut method to get given metadata property. Equivalent to:
              getMetadata().get(tokId, prop, dflt);
         
        Type Parameters:
        T - Type of the metadata property.
        Parameters:
        prop - Metadata property name.
        dflt - Default value to return if specified one isn't set.
        Returns:
        Metadata property value or default value if one isn't set.