|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.cmf.Content
public class Content
Contains the information required to store new content data together with additional meta-data.
All content is determined by its mime type and the raw data that will be used to load the content. The type of the data is dependent on the mime type.
For example, images can be loaded from byte arrays and texts can be loaded from strings. If an unsupported data type is used or the format is incorrect, suitable exceptions will be thrown when the content is stored in the back-end.
| Constructor Summary | |
|---|---|
Content(MimeType mimeType,
Object data)
Creates a new Content instance with the minimal required
arguments. |
|
| Method Summary | |
|---|---|
Content |
attribute(String name,
boolean value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
byte value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
char value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
double value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
float value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
int value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
long value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
short value)
Sets a named content attribute that will be converted internally to a String value. |
Content |
attribute(String name,
String value)
Sets a named content attribute. |
Content |
attributes(Map<String,String> attributes)
Replaces the map of named content attributes. |
Content |
cachedLoadedData(Object data)
Sets the cached loaded data. |
Content |
clone()
Simply clones the instance with the default clone method since we want to create a shallow copy |
Content |
fragment(boolean fragment)
Sets whether the content data is a fragment. |
String |
getAttribute(String name)
Retrieves the value of a named content attribute. |
Map<String,String> |
getAttributes()
Retrieves the map of named content attributes. |
Object |
getCachedLoadedData()
Retrieves the cached loaded content data. |
Object |
getData()
Retrieves the data of the content. |
MimeType |
getMimeType()
Retrieves the mime type of the content. |
String |
getName()
Retrieves the name of the content. |
Map<String,String> |
getProperties()
Retrieves the content properties. |
String |
getProperty(String name)
Retrieves the value of a named content property. |
boolean |
hasAttribute(String name)
Indicates whether a specific named content attribute is present. |
boolean |
hasAttributes()
Indicates whether named content attributes are present. |
boolean |
hasCachedLoadedData()
Indicates whether cached loaded content data is present. |
boolean |
hasName()
Indicates whether the content data has a name. |
boolean |
hasProperties()
Indicates whether content properties are present |
boolean |
hasProperty(String name)
Indicates whether a specific named content property is present. |
boolean |
isFragment()
Indicates whether the content data is a fragment. |
Content |
name(String name)
Sets the name of the content. |
Content |
properties(Map<String,String> properties)
Replaces the content properties. |
Content |
property(String name,
boolean value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
byte value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
char value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
double value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
float value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
int value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
long value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
short value)
Sets a named content property that will be converted internally to a String value. |
Content |
property(String name,
String value)
Sets a named content property. |
void |
setAttributes(Map<String,String> attributes)
Replaces the map of named content attributes. |
void |
setCachedLoadedData(Object data)
Sets the cached loaded data. |
void |
setData(Object data)
Sets the data of the content. |
void |
setFragment(boolean fragment)
Sets whether the content data is a fragment. |
void |
setName(String name)
Sets the name of the content. |
void |
setProperties(Map<String,String> properties)
Replaces the content properties. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Content(MimeType mimeType,
Object data)
Content instance with the minimal required
arguments.
mimeType - the mime type as which the content will be stored in
the back-end, note that this doesn't necessarily has to correspond to
the mime type of the provided data. Image formats can for example be
automatically detected and converted to the target mime type by image
loading and conversion libraries.data - the data of the content, if this is null,
empty content should be stored| Method Detail |
|---|
public MimeType getMimeType()
public Object getData()
public void setData(Object data)
public Content fragment(boolean fragment)
fragment - true if the content is a fragment; or
false otherwise
Content instancesetFragment(boolean),
isFragment()public void setFragment(boolean fragment)
fragment - true if the content is a fragment; or
false otherwise
fragment(boolean),
isFragment()public boolean isFragment()
true if the content is a fragment; or
false otherwise
fragment(boolean),
setFragment(boolean)public Content name(String name)
name - the name
Content instancesetName(String),
getName(),
hasName()public void setName(String name)
name - the namename(String),
getName(),
hasName()public String getName()
null if the content has no name; or
the name of the content
name(String),
setName(String),
hasName()public boolean hasName()
true if the content has a name; or
false otherwise
name(String),
setName(String),
getName()public Content attributes(Map<String,String> attributes)
Note that attributes provide information about how to load, convert and transform content into its stored data form. If you want to provide meta information about the content, you should provide it through properties instead.
attributes - the map of named content attributes
Content instancesetAttributes(Map),
getAttributes(),
hasAttributes()
public Content attribute(String name,
boolean value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
char value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
byte value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
short value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
int value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
long value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
float value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
double value)
String value.
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)
public Content attribute(String name,
String value)
name - the name of the attributevalue - the value of the attribute
Content instancegetAttribute(String),
hasAttribute(String)public void setAttributes(Map<String,String> attributes)
attributes - the map of named content attributesattributes(Map),
getAttributes(),
hasAttributes()public Map<String,String> getAttributes()
null if no attributes are present
attributes(Map),
setAttributes(Map),
hasAttributes()public boolean hasAttributes()
true if named content attributes are present; or
false otherwise
attributes(Map),
setAttributes(Map),
getAttributes()public boolean hasAttribute(String name)
name - the name of the attribute
true if the name content attribute is present; or
false otherwise
getAttribute(String)public String getAttribute(String name)
name - the name of the attribute
null if no such attribute could be found
hasAttribute(String)public Content properties(Map<String,String> properties)
This is also internally used by content formatters to provide additional information about the content that's stored after formatting and transformation. Note that this is not the same as content attributes, who provide infomration about how to format and transform the provided data before storage. The content properties describe the result as it's stored in the back-end.
properties - the content properties
Content instancesetProperties(Map),
hasProperties(),
getProperties()
public Content property(String name,
boolean value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
char value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
byte value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
short value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
int value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
long value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
float value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
double value)
String value.
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)
public Content property(String name,
String value)
name - the name of the propertyvalue - the value of the property
Content instancegetProperty(String),
hasProperty(String)public void setProperties(Map<String,String> properties)
properties - the content propertiesproperties(Map),
hasProperties(),
getProperties()public boolean hasProperties()
true if properties are present; or
false otherwise
properties(Map),
setProperties(Map),
getProperties()public boolean hasProperty(String name)
name - the name of the property
true if the name content property is present; or
false otherwise
getProperty(String)public String getProperty(String name)
name - the name of the property
null if no such property could be found
hasProperty(String)public Map<String,String> getProperties()
null if no content properties are present
properties(Map),
setProperties(Map),
hasProperties()public Content cachedLoadedData(Object data)
This is internally used by content loaders to prevent having to load and convert data to the specified mime type several times for the same content. It is for instance very resource intensive to detect an image format, validate the provided raw data and create a generic image instance for further processing. These operations are however required in several different locations in the content handling logic. Storing the result after the first successful loading and simply retrieving it later enhances the speed considerably.
data - the loaded data
Content instancesetCachedLoadedData(Object),
hasCachedLoadedData(),
getCachedLoadedData()public void setCachedLoadedData(Object data)
data - the loaded datacachedLoadedData(Object),
hasCachedLoadedData(),
getCachedLoadedData()public boolean hasCachedLoadedData()
true if cached loaded content data is present; or
false otherwise
cachedLoadedData(Object),
setCachedLoadedData(Object),
getCachedLoadedData()public Object getCachedLoadedData()
null if no loaded content data has been cached
cachedLoadedData(Object),
setCachedLoadedData(Object),
hasCachedLoadedData()public Content clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||