public class PropertyUtil extends Object
Constructor and Description |
---|
PropertyUtil() |
Modifier and Type | Method and Description |
---|---|
static javax.jcr.Value |
createValue(Object obj,
javax.jcr.ValueFactory valueFactory) |
static javax.jcr.Value |
createValue(String valueStr,
int type,
javax.jcr.ValueFactory valueFactory)
Transforms a string to a jcr value object.
|
static boolean |
getBoolean(javax.jcr.Node node,
String name,
boolean defaultValue)
Return the boolean representing the node property value.
|
static Calendar |
getDate(javax.jcr.Node node,
String name)
Return the Calendar representing the node property value.
|
static Calendar |
getDate(javax.jcr.Node node,
String name,
Calendar defaultValue)
Return the Calendar representing the node property value.
|
static String |
getDateFormat() |
static int |
getJCRPropertyType(Object obj) |
static Long |
getLong(javax.jcr.Node node,
String name) |
static Long |
getLong(javax.jcr.Node node,
String name,
Long defaultValue) |
static javax.jcr.Property |
getProperty(javax.jcr.Node node,
String relativePath)
Deprecated.
since 4.5 - use getPropertyOrNull instead
|
static javax.jcr.Property |
getPropertyOrNull(javax.jcr.Node node,
String relativePath)
Return the Property relative to the Node or null if it's not existing or in case of any RepositoryException.
|
static Object |
getPropertyValueObject(javax.jcr.Node node,
String relativePath)
Return the Value Object from a property.
|
static String |
getString(javax.jcr.Node node,
String name)
Return the String representing the node property value.
|
static String |
getString(javax.jcr.Node node,
String name,
String defaultValue)
Return the String representing the node property value.
|
static Object |
getValueObject(javax.jcr.Value value)
Return the Value Object from a
Value . |
static List<String> |
getValuesStringList(javax.jcr.Value[] values) |
static String |
getValueString(javax.jcr.Property property)
Returns value of the property converted to string no matter what it's type actually is.
|
static String |
getValueString(javax.jcr.Value value)
Returns value converted to string no matter what it's type actually is.
|
static javax.jcr.Property |
renameProperty(javax.jcr.Property property,
String newName) |
static void |
setProperty(javax.jcr.Node node,
String propertyName,
Object propertyValue)
Allows setting a Node's property from an object.
|
static void |
updateOrCreate(javax.jcr.Node node,
String string,
GregorianCalendar gregorianCalendar)
Updates existing property or creates a new one if it doesn't exist already.
|
public static javax.jcr.Property renameProperty(javax.jcr.Property property, String newName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void setProperty(javax.jcr.Node node, String propertyName, Object propertyValue) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Value createValue(String valueStr, int type, javax.jcr.ValueFactory valueFactory)
public static int getJCRPropertyType(Object obj)
public static void updateOrCreate(javax.jcr.Node node, String string, GregorianCalendar gregorianCalendar) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static String getDateFormat()
public static String getValueString(javax.jcr.Property property)
getDateFormat()
. Binary and reference values are converted to empty string. In case of error during conversion, null will be returned instead. Works only for single value properties.public static String getValueString(javax.jcr.Value value)
getDateFormat()
. Binary and reference values are converted to empty string. In case of error during conversion, null will be returned instead.public static javax.jcr.Value createValue(Object obj, javax.jcr.ValueFactory valueFactory) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Calendar getDate(javax.jcr.Node node, String name)
public static Calendar getDate(javax.jcr.Node node, String name, Calendar defaultValue)
public static String getString(javax.jcr.Node node, String name)
public static String getString(javax.jcr.Node node, String name, String defaultValue)
public static boolean getBoolean(javax.jcr.Node node, String name, boolean defaultValue)
public static javax.jcr.Property getPropertyOrNull(javax.jcr.Node node, String relativePath)
@Deprecated public static javax.jcr.Property getProperty(javax.jcr.Node node, String relativePath)
public static Object getPropertyValueObject(javax.jcr.Node node, String relativePath)
PropertyType
type or in case
of multivalue, a LinkedList of PropertyType
type objects.public static Object getValueObject(javax.jcr.Value value)
Value
.
Return null in case of exception.Copyright © 2003–2020 Magnolia International Ltd.. All rights reserved.