Class JSONService

    • Field Detail

      • bagManager

        protected final BagManager bagManager
      • model

        protected final Model model
    • Constructor Detail

      • JSONService

        public JSONService​(InterMineAPI im)
        Constructor
        Parameters:
        im - The InterMine configuration object.
    • Method Detail

      • postInit

        protected void postInit()
        Description copied from class: WebService
        Subclasses can hook in here to do common behaviour that needs to happen after initialisation.
        Overrides:
        postInit in class WebService
      • getResultsKey

        protected java.lang.String getResultsKey()
        Returns:
        The key for the results property.
      • lazyList

        protected boolean lazyList()
        Returns:
        Whether to treat this as a lazy list.
      • getHeaderAttributes

        protected java.util.Map<java.lang.String,​java.lang.Object> getHeaderAttributes()
        Get the header attributes to apply to the formatter.
        Returns:
        A map from string to object.
      • addOutputInfo

        protected void addOutputInfo​(java.lang.String key,
                                     java.lang.String value)
        Add a key value pair to put in the header of json results.
        Parameters:
        key - An identifier.
        value - Some piece of data.
      • addResultItem

        protected void addResultItem​(java.util.Map<java.lang.String,​? extends java.lang.Object> mapping,
                                     boolean hasMore)
        Output a map of names and values as a JSON object.
        Parameters:
        mapping - the mapping of things to output.
        hasMore - Whether there is more to come, and thus a comma is required.
      • addResultValue

        protected void addResultValue​(java.lang.CharSequence str,
                                      boolean hasMore)
        Output a char-sequence as a JSON value.
        Parameters:
        str - The character sequence.
        hasMore - Whether there are more to come.
      • addResultValue

        protected void addResultValue​(java.lang.Number num,
                                      boolean hasMore)
        Output a number as a JSON value.
        Parameters:
        num - The number.
        hasMore - Whether there are more to come.
      • addResultValue

        protected void addResultValue​(java.lang.Boolean bool,
                                      boolean hasMore)
        Output a bool as a JSON value.
        Parameters:
        bool - The boolean.
        hasMore - Whether there are more.
      • addResultEntries

        protected void addResultEntries​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entries)
        Parameters:
        entries - The entries to output
      • addResultEntry

        protected void addResultEntry​(java.lang.String key,
                                      java.lang.Object value,
                                      boolean hasMore)
        Output a single entry.
        Parameters:
        key - The key
        value - The value
        hasMore - Whether there are more to come.
      • addResultEntry

        protected void addResultEntry​(java.util.Map.Entry<java.lang.String,​java.lang.Object> entry,
                                      boolean hasMore)
        Output a single entry.
        Parameters:
        entry - The entry
        hasMore - Whether there are more to come.
      • addResultEntries

        protected void addResultEntries​(java.util.Collection<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entries,
                                        boolean hasMore)
        Output a bunch of entries.
        Parameters:
        entries - The entries
        hasMore - Whether there are more of them to come.
      • addResultItem

        protected void addResultItem​(java.util.List<? extends java.lang.Object> listing,
                                     boolean hasMore)
        Output a list of objects as a JSON array.
        Parameters:
        listing - The list of things to output.
        hasMore - Whether there is more to come, and thus a comma is required.
      • getDefaultFormat

        protected Format getDefaultFormat()
        Overrides:
        getDefaultFormat in class WebService
        Returns:
        The default format constant for this service.