Package org.bridgedb

Class DataSource.Builder

  • Enclosing class:
    DataSource

    public static final class DataSource.Builder
    extends Object
    Uses builder pattern to set optional attributes for a DataSource. For example, this allows you to use the following code:
     DataSource.register("X", "Affymetrix")
         .mainUrl("http://www.affymetrix.com")
         .type("probe")
         .primary(false);
     
    • Method Detail

      • asDataSource

        public DataSource asDataSource()
        Returns:
        the DataSource under construction
      • urlPattern

        public DataSource.Builder urlPattern​(String urlPattern)
        Parameters:
        urlPattern - is a template for generating valid URL's for identifiers. The pattern should contain the substring "$ID", which will be replaced by the actual identifier. Since version 2.0.0 it is no longer allowed to change the urlPattern once set.
        Returns:
        the same Builder object so you can chain setters
      • mainUrl

        public DataSource.Builder mainUrl​(String mainUrl)
        Note: Since version 2 this method no longer allows changing a mainUrl once set.
        Parameters:
        mainUrl - url of homepage
        Returns:
        the same Builder object so you can chain setters
        Throws:
        IllegalArgumentException - is a none null mainUrl is changed to a different value.
      • idExample

        public DataSource.Builder idExample​(String idExample)
        Note: Unlike most builder methods this one does allow the idExample to be change even if already set. There may be good reasons why a specific example works better in a specific case then the original one set. However there is no known case that replies on this flexibility to change.
        Parameters:
        idExample - an example id from this system
        Returns:
        the same Builder object so you can chain setters
      • primary

        public DataSource.Builder primary​(boolean isPrimary)
        Note: Unlike most builder methods this one does allow the idPrimary to be change even if already set. There may be good reasons why a specific DataSource's primary status is different in different applications. However there is no known case that replies this on flexibility to change.
        Parameters:
        isPrimary - secondary id's such as EC numbers, Gene Ontology or vendor-specific systems occur in data or linkouts, but their use in pathways is discouraged
        Returns:
        the same Builder object so you can chain setters
      • deprecated

        public DataSource.Builder deprecated​(boolean isDeprecated)
        Parameters:
        isDeprecated - a boolean indicating this DataSource should no longer be used
        Returns:
        the same Builder object so you can chain setters
      • deprecatedBy

        public DataSource.Builder deprecatedBy​(DataSource sourceToUseInstead)
        Sets the DataSource which should be used instead of this deprecated one. It automatically sets isDeprecated to true.
        Parameters:
        sourceToUseInstead - the DataSource that should be used instead of this deprecated one
        Returns:
        the same Builder object so you can chain setters
      • type

        public DataSource.Builder type​(String type)
        Since version 2 This method no longer allow changing the type of a DataSource once set.
        Parameters:
        type - the type of datasource, for example "protein", "gene", "metabolite"
        Returns:
        the same Builder object so you can chain setters
      • organism

        public DataSource.Builder organism​(Object organism)
        Since version 2 This method no longer allows you to change the Organism of a DataSource once set.
        Parameters:
        organism - organism for which this system code is suitable, or null for any / not applicable
        Returns:
        the same Builder object so you can chain setters
      • urnBase

        public DataSource.Builder urnBase​(String base)
        This adds a miriam base to the DataSource. Note: Since version 2 The base must start with urn:miriam:. The urnBase and identifiersOrgBase methods share the same miriam base. If the SystemCode is used as the urnBase this is just ignored! (As the default to use the sysCode as the urnbase)
        Parameters:
        base - for urn generation, for example "urn:miriam:uniprot"
        Returns:
        the same Builder object so you can chain setters
      • identifiersOrgBase

        public DataSource.Builder identifiersOrgBase​(String base)
        Note: Since version 2 The base must start with urn:miriam:. The urnBase and identifiersOrgBase methods share the same miriam basee. It is no longer allowed to change a none null miriam Base
        Parameters:
        base - for identifiersOrg generation, for example "http://www.identifiers.org/uniprot" It will also accept an identifiersOrg Pattern such as "http://www.identifiers.org/uniprot/$id"
        Returns:
        the same Builder object so you can chain setters
      • alternative

        public DataSource.Builder alternative​(String alternative)
        Allow the setting but not changing of an alternative name
        Parameters:
        alternative -
        Returns:
        the same Builder object so you can chain setters
        Since:
        version 2.0.0
      • description

        public DataSource.Builder description​(String description)
        Allow the setting but not changing of a description
        Parameters:
        alternative -
        Returns:
        the same Builder object so you can chain setters
        Since:
        version 2.0.0