|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.odata4j.core.OEntityKey
public class OEntityKey
An immutable entity-key, made up of either a single unnamed-value or multiple named-values.
Every entity must have an entity-key. The entity-key must be unique within the entity-set, and thus defines an entity's identity. (see OEntityId
)
An entity-key made up a a single unnamed-value is called a single key. An entity-key made up of multiple named-values is called a complex key.
The string representation of an entity-key is wrapped with parentheses, such as (2)
, ('foo')
or (a=1,foo='bar')
.
Entity-keys are equal if their string representations are equal.
Nested Class Summary | |
---|---|
static class |
OEntityKey.KeyType
SINGLE or COMPLEX |
Method Summary | |
---|---|
Set<OProperty<?>> |
asComplexProperties()
Gets the values of complex entity-key. |
Set<NamedValue<?>> |
asComplexValue()
Gets the values of a complex entity-key. |
Object |
asSingleValue()
Gets a the value of a single-valued entity-key. |
static OEntityKey |
create(Map<String,Object> values)
Creates an entity-key from a map of names and values. |
static OEntityKey |
create(Object... values)
Creates an entity-key. |
boolean |
equals(Object obj)
|
Object |
getComplexKeyValue(String name)
returns the value for a named value in a complex key. |
OEntityKey.KeyType |
getKeyType()
Gets the entity-key type: SINGLE or COMPLEX. |
int |
hashCode()
|
static OEntityKey |
infer(EdmEntitySet entitySet,
List<OProperty<?>> props)
Creates an entity-key using key information from the given entity-set and values from the given property list. |
static OEntityKey |
parse(String keyString)
Creates an entity-key from its standard string representation. |
String |
toKeyString()
Gets the standard string representation of this entity-key, including parentheses. |
String |
toKeyStringWithoutParentheses()
Gets the standard string representation of this entity-key, excluding parentheses. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public Set<OProperty<?>> asComplexProperties()
public Set<NamedValue<?>> asComplexValue()
public Object asSingleValue()
public static OEntityKey create(Map<String,Object> values)
values
- the map of names and values
public static OEntityKey create(Object... values)
OEntityKey.create(2)
OEntityKey.create("foo")
OEntityKey.create("a",1,"foo","bar")
OEntityKey.create(NamedValues.create("a",1),NamedValues.create("foo","bar"))
values
- the key values
public boolean equals(Object obj)
equals
in class Object
public Object getComplexKeyValue(String name)
name
-
public OEntityKey.KeyType getKeyType()
public int hashCode()
hashCode
in class Object
public static OEntityKey infer(EdmEntitySet entitySet, List<OProperty<?>> props)
entitySet
- an entity-set to provide key informationprops
- a list of properties to provide key values
public static OEntityKey parse(String keyString)
keyString
- a standard key-string
public String toKeyString()
public String toKeyStringWithoutParentheses()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |