Package com.contentful.java.cma.model
Class CMAAsset.Fields
- java.lang.Object
-
- com.contentful.java.cma.model.CMAAsset.Fields
-
- Enclosing class:
- CMAAsset
public static class CMAAsset.Fields extends java.lang.ObjectCollect all fields of an asset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCMAAsset.Fields.LocalizedLocalize all fields with a given locale.
-
Constructor Summary
Constructors Constructor Description Fields()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription(java.lang.String locale)Retrieve the description to the given locale.CMAAssetFilegetFile(java.lang.String locale)Return the localized file of this asset.java.lang.StringgetTitle(java.lang.String locale)What is the title of this asset in a given locale?CMAAsset.Fields.Localizedlocalize(java.lang.String locale)Localize access to fields by the same locale.CMAAsset.FieldssetDescription(java.lang.String locale, java.lang.String description)Set the description in a specific locale.CMAAsset.FieldssetFile(java.lang.String locale, CMAAssetFile file)Update or create a new file for this asset.CMAAsset.FieldssetTitle(java.lang.String locale, java.lang.String title)Update or set title in a given locale.java.lang.StringtoString()For debugging, it returns only the en-US locales!java.lang.StringtoString(java.lang.String locale)
-
-
-
Method Detail
-
getDescription
public java.lang.String getDescription(java.lang.String locale)
Retrieve the description to the given locale.- Parameters:
locale- which locale should the description be in?- Returns:
- a string representing the description in the given locale.
-
setDescription
public CMAAsset.Fields setDescription(java.lang.String locale, java.lang.String description)
Set the description in a specific locale.- Parameters:
locale- the locale to be used. Think 'en-US'.description- the text of the description, localized into the locale.- Returns:
- the
CMAAsset.Fieldsinstance calling, used for chaining.
-
getTitle
public java.lang.String getTitle(java.lang.String locale)
What is the title of this asset in a given locale?- Parameters:
locale- the locale to check for a title- Returns:
- the localized title, or null if no entry for this locale was found.
-
setTitle
public CMAAsset.Fields setTitle(java.lang.String locale, java.lang.String title)
Update or set title in a given locale.If a title in the given locale is present, update it, otherwise create a new one.
- Parameters:
locale- which locale to be used.title- the title corresponding to this locale.- Returns:
- The same
CMAAsset.Fieldsinstance used to calling other setters for chaining.
-
getFile
public CMAAssetFile getFile(java.lang.String locale)
Return the localized file of this asset.Returns
CMAAssetFilefor the given locale.- Parameters:
locale- which locale should be used to select the right file?- Returns:
- the CMAAssetFile listed under the given locale.
-
setFile
public CMAAsset.Fields setFile(java.lang.String locale, CMAAssetFile file)
Update or create a new file for this asset.- Parameters:
locale- which locale to be used?file- the actual file to be set.- Returns:
- For chaining, return the same instance getting called with.
-
localize
public CMAAsset.Fields.Localized localize(java.lang.String locale)
Localize access to fields by the same locale.Use this to not keep repeating the same locale for fields.
- Parameters:
locale- a code of a locale. Think `en-US`.- Returns:
- a visitor to localize all upcoming field access.
-
toString
public java.lang.String toString(java.lang.String locale)
- Parameters:
locale- the locale to be used for converting.- Returns:
- a human readable string, representing the object.
-
toString
public java.lang.String toString()
For debugging, it returns only the en-US locales!- Overrides:
toStringin classjava.lang.Object- Returns:
- a human readable string, representing the object.
- See Also:
toString(String)
-
-