Esempio n. 1
0
  /**
   * Factory method that creates an XDI link contract (template) bound to a given XDI entity.
   *
   * @param xdiEntity The XDI entity that is an XDI link contract (template).
   * @return The XDI link contract (template).
   */
  public static LinkContractBase<?> fromXdiEntity(XdiEntity xdiEntity) {

    LinkContractBase<?> linkContractBase = null;

    if ((linkContractBase = LinkContract.fromXdiEntity(xdiEntity)) != null) return linkContractBase;
    if ((linkContractBase = LinkContractTemplate.fromXdiEntity(xdiEntity)) != null)
      return linkContractBase;

    return null;
  }
Esempio n. 2
0
  /**
   * Checks if an XDI entity is a valid XDI link contract (template).
   *
   * @param xdiEntity The XDI entity to check.
   * @return True if the XDI entity is a valid XDI link contract (template).
   */
  public static boolean isValid(XdiEntity xdiEntity) {

    if (xdiEntity == null) return false;

    return LinkContract.isValid(xdiEntity) || LinkContractTemplate.isValid(xdiEntity);
  }