Package org.spdx.core

Class SimpleUriValue

  • All Implemented Interfaces:
    IndividualUriValue

    public class SimpleUriValue
    extends Object
    implements IndividualUriValue
    Simple class to just store a URI value

    The method toModelObject will convert / inflate the value back to either an Enum (if the URI matches), an ExternalSpdxElement if it matches the pattern of an external SPDX element or returns itself otherwise

    Author:
    Gary O'Neall
    • Constructor Detail

      • SimpleUriValue

        public SimpleUriValue​(IndividualUriValue fromIndividualValue)
        Parameters:
        fromIndividualValue - individual value to copy the URI from
      • SimpleUriValue

        public SimpleUriValue​(String uri)
        Parameters:
        uri - URI for the value
    • Method Detail

      • getIndividualUriValueHash

        public static int getIndividualUriValueHash​(IndividualUriValue individualUri)
        returns hash based on URI of the IndividualUriValue
        Parameters:
        individualUri - IndividualUriValue to obtain a hash from
        Returns:
        hash based on URI of the IndividualUriValue
      • isIndividualUriValueEquals

        public static boolean isIndividualUriValueEquals​(IndividualUriValue individualUri,
                                                         Object comp)
        Compares an object to an individual URI and returns true if the URI values are equal
        Parameters:
        individualUri - IndividualUriValue to compare
        comp - Object to compare
        Returns:
        true if the individualUri has the same URI as comp and comp is of type IndividualUriValue
      • getIndividualURI

        public String getIndividualURI()
        Specified by:
        getIndividualURI in interface IndividualUriValue
        Returns:
        a unique identifier for this value. Typically the namespace + the long name
      • toModelObject

        public Object toModelObject​(IModelStore store,
                                    IModelCopyManager copyManager,
                                    String specVersion,
                                    @Nullable
                                    Class<?> type)
                             throws InvalidSPDXAnalysisException
        inflate the value back to either an Enum (if the URI matches), an Individual (if the URI matches), the modelObject (if the store contains the object matching the URI), or an ExternalObject if not in the store
        Parameters:
        store - store to use for the inflated object
        copyManager - if non-null, implicitly copy any referenced properties from other model stores
        specVersion - version of the SPDX spec the object complies with
        type - optional type hint - used for individuals where the type may be ambiguous
        Returns:
        Enum, ExternalSpdxElement or itself depending on the pattern
        Throws:
        InvalidSPDXAnalysisException - on any store or parsing error
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object