Package org.eclipse.rdf4j.model.impl
Class GenericStatement<R extends Resource,I extends IRI,V extends Value>
java.lang.Object
org.eclipse.rdf4j.model.impl.GenericStatement<R,I,V>
- All Implemented Interfaces:
Serializable
,Statement
- Direct Known Subclasses:
ExtensibleStatementImpl
,LinkedHashModel.ModelStatement
,MemStatement
@Experimental
public class GenericStatement<R extends Resource,I extends IRI,V extends Value>
extends Object
implements Statement
An implementation of the Statement interface with support for Java Generics.
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
GenericStatement
(R subject, I predicate, V object, R context) Creates a new Statement with the supplied subject, predicate and object for the specified associated context. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this statement to another object.Gets the context of this statement.Gets the object of this statement.Gets the predicate of this statement.Gets the subject of this statement.int
hashCode()
Computes the hash code of this statement.toString()
-
Field Details
-
subject
-
predicate
-
object
-
context
-
-
Constructor Details
-
GenericStatement
Creates a new Statement with the supplied subject, predicate and object for the specified associated context.Note that creating an objects directly via this constructor is not the recommended approach. Instead, use a
ValueFactory
(obtained from your repository or by usingSimpleValueFactory.getInstance()
) to create new Statement objects.- Parameters:
subject
- The statement's subject, must not be null.predicate
- The statement's predicate, must not be null.object
- The statement's object, must not be null.context
- The statement's context, null to indicate no context is associated.
-
-
Method Details
-
getSubject
Description copied from interface:Statement
Gets the subject of this statement.- Specified by:
getSubject
in interfaceStatement
- Returns:
- The statement's subject.
-
getPredicate
Description copied from interface:Statement
Gets the predicate of this statement.- Specified by:
getPredicate
in interfaceStatement
- Returns:
- The statement's predicate.
-
getObject
Description copied from interface:Statement
Gets the object of this statement. -
getContext
Description copied from interface:Statement
Gets the context of this statement.- Specified by:
getContext
in interfaceStatement
- Returns:
- The statement's context, or null in case of the null context or if not applicable.
-
equals
Description copied from interface:Statement
Compares this statement to another object. -
hashCode
public int hashCode()Description copied from interface:Statement
Computes the hash code of this statement.- Specified by:
hashCode
in interfaceStatement
- Overrides:
hashCode
in classObject
- Returns:
- a hash code for this statement computed as
Objects.hash
(Statement.getSubject()
,Statement.getPredicate()
,Statement.getObject()
,Statement.getContext()
)
-
toString
-