public class CDAAsset extends LocalizedResource
LocalizedResource.Localizer
Constructor and Description |
---|
CDAAsset() |
Modifier and Type | Method and Description |
---|---|
<T> T |
fileField(java.lang.String key)
Helper method to extract a field from the
file map. |
java.lang.String |
mimeType() |
java.lang.String |
title() |
java.lang.String |
toString()
Return a string, showing the id and title.
|
java.lang.String |
url() |
java.lang.String |
urlForImageWith(ImageOption... options)
Returns a url with the given image manipulation.
|
getField, getField, localize, rawFields, setField
attrs, getAttribute, id, type
public java.lang.String title()
public java.lang.String url()
public java.lang.String urlForImageWith(ImageOption... options)
If the asset is not pointing to an image (as identified by its mimetype) the url()
is
returned. Same happens if the options are empty or non existing, then the url gets returned.
In an error case (for instance, using the same option twice), the last option with the same operation will be used.
options
- to manipulate the image the returned url will be pointing to.java.lang.IllegalArgumentException
- if no options are given.java.lang.IllegalArgumentException
- if no mimetype was set on asset.java.lang.IllegalArgumentException
- if mimetype was not an image.ImageOption
,
url()
public java.lang.String mimeType()
public <T> T fileField(java.lang.String key)
file
map.T
- the type of this field.key
- the key who's value to be returned.public java.lang.String toString()
toString
in class CDAResource
Copyright © 2019 Contentful, GmbH.. All Rights Reserved.