Package com.contentful.java.cma.model
Class CMAEntry
- java.lang.Object
-
- com.contentful.java.cma.model.CMAResource
-
- com.contentful.java.cma.model.CMAEntry
-
public class CMAEntry extends CMAResource
Represents a resource of type Entry.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCMAEntry.LocalizedLocalize all fields with a given locale.
-
Field Summary
Fields Modifier and Type Field Description CMAMetadatametadata
-
Constructor Summary
Constructors Constructor Description CMAEntry()Create an entry, filling the system property
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetField(java.lang.String key, java.lang.String locale)Return a specific localized field.java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>>getFields()CMAMetadatagetMetadata()CMAEntry.Localizedlocalize(java.lang.String locale)Manipulate fields with the same locale.CMAEntrysetEnvironmentId(java.lang.String environmentId)Convenience: Update the environment id, without going throughCMAResource.getSystem().CMAEntrysetField(java.lang.String key, java.lang.String locale, java.lang.Object value)Creates a new field with the givenvalue.CMAEntrysetFields(java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>> fields)Sets a map of fields for this Entry.CMAEntrysetId(java.lang.String id)Convenience: Update the id of this entry without going throughCMAResource.getSystem().CMAEntrysetMetadata(CMAMetadata metadata)Sets the metadata for this entry.CMAEntrysetSpaceId(java.lang.String spaceId)Convenience: Update the space id of this entry without going throughCMAResource.getSystem().CMAEntrysetSystem(CMASystem system)Sets the system field.CMAEntrysetVersion(java.lang.Integer version)Convenience: Update the version of this entry without going throughCMAResource.getSystem().java.lang.StringtoString()-
Methods inherited from class com.contentful.java.cma.model.CMAResource
getEnvironmentId, getId, getSpaceId, getSystem, getVersion, getVisibility, isArchived, isPublished, setVisibility
-
-
-
-
Field Detail
-
metadata
public CMAMetadata metadata
-
-
Method Detail
-
setSystem
public CMAEntry setSystem(CMASystem system)
Sets the system field.- Overrides:
setSystemin classCMAResource- Parameters:
system- sets the system property.- Returns:
- this, as casted to a resource, for the ease of chaining.
-
setId
public CMAEntry setId(java.lang.String id)
Convenience: Update the id of this entry without going throughCMAResource.getSystem().- Overrides:
setIdin classCMAResource- Parameters:
id- to be set.- Returns:
- the calling instance for chaining.
-
setVersion
public CMAEntry setVersion(java.lang.Integer version)
Convenience: Update the version of this entry without going throughCMAResource.getSystem().- Overrides:
setVersionin classCMAResource- Parameters:
version- to be set.- Returns:
- the calling instance for chaining.
-
setSpaceId
public CMAEntry setSpaceId(java.lang.String spaceId)
Convenience: Update the space id of this entry without going throughCMAResource.getSystem().- Overrides:
setSpaceIdin classCMAResource- Parameters:
spaceId- to be set.- Returns:
- the calling instance for chaining.
-
setEnvironmentId
public CMAEntry setEnvironmentId(java.lang.String environmentId)
Convenience: Update the environment id, without going throughCMAResource.getSystem().- Overrides:
setEnvironmentIdin classCMAResource- Parameters:
environmentId- to be set.- Returns:
- the calling instance for chaining.
-
setField
public CMAEntry setField(java.lang.String key, java.lang.String locale, java.lang.Object value)
Creates a new field with the givenvalue. If a field namedkeyalready exists it will be replaced.- Parameters:
key- field keylocale- localevalue- value- Returns:
- this
CMAEntry
-
getField
public <T> T getField(java.lang.String key, java.lang.String locale)Return a specific localized field.- Type Parameters:
T- the type of the return value- Parameters:
key- the key of the fieldlocale- the locale of the key- Returns:
- the value requested or null, if something (fields, key, locale) was not found.
-
getFields
public java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>> getFields()
- Returns:
- a map of fields for this Entry.
-
getMetadata
public CMAMetadata getMetadata()
-
setMetadata
public CMAEntry setMetadata(CMAMetadata metadata)
Sets the metadata for this entry.- Parameters:
metadata- TheCMAMetadatainstance to associate with this entry.- Returns:
- This
CMAEntryinstance for method chaining.
-
setFields
public CMAEntry setFields(java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>> fields)
Sets a map of fields for this Entry.- Parameters:
fields- the fields to be set- Returns:
- this
CMAEntryinstance
-
localize
public CMAEntry.Localized localize(java.lang.String locale)
Manipulate fields with the same locale.- Parameters:
locale- the locale to be used for accessing fields.- Returns:
- an instance of
CMAEntry.Localizedto be used for setting subsequent fields.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classCMAResource- Returns:
- a human readable string, representing the object.
-
-