info.magnolia.ui.vaadin.integration.jcr
Class DefaultPropertyUtil

java.lang.Object
  extended by info.magnolia.ui.vaadin.integration.jcr.DefaultPropertyUtil

public class DefaultPropertyUtil
extends Object

Default Property Utility Class. Allows the creation of custom Value Object.


Constructor Summary
DefaultPropertyUtil()
           
 
Method Summary
static Object createTypedValue(Class<?> type, String defaultValue)
          Create a custom Field Object based on the Type and defaultValue.
static Object createTypedValue(String fieldType, String defaultValue)
          Deprecated. since 5.1. use createTypedValue(Class, String) instead.
static Class<?> getFieldTypeClass(int fieldType)
          Return the related Class for a desired Type.
static Class<?> getFieldTypeClass(String fieldType)
          Return the related Class for a desired Type by String.
static
<T> DefaultProperty<T>
newDefaultProperty(Class<T> type, String defaultValue)
          Create a DefaultProperty and set the defaultValue after conversion.
static DefaultProperty newDefaultProperty(int fieldType, Object value)
          Deprecated. since 5.1. use newDefaultProperty(Class, String) instead.
static DefaultProperty newDefaultProperty(String fieldType, String stringValue)
          Deprecated. since 5.1. use newDefaultProperty(Class, String) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertyUtil

public DefaultPropertyUtil()
Method Detail

newDefaultProperty

public static <T> DefaultProperty<T> newDefaultProperty(Class<T> type,
                                                        String defaultValue)
Create a DefaultProperty and set the defaultValue after conversion.


newDefaultProperty

@Deprecated
public static DefaultProperty newDefaultProperty(String fieldType,
                                                            String stringValue)
                                          throws NumberFormatException
Deprecated. since 5.1. use newDefaultProperty(Class, String) instead.

Create a new DefaultProperty by passing the value as a String. If fieldType is defined, create a Typed Value. If fieldType is not defined, create a String Value. If stringValue is defined, create a typed value based on fieldType.

Throws:
NumberFormatException

newDefaultProperty

@Deprecated
public static DefaultProperty newDefaultProperty(int fieldType,
                                                            Object value)
                                          throws NumberFormatException
Deprecated. since 5.1. use newDefaultProperty(Class, String) instead.

Create a DefaultProperty based on types defined in PropertyType.

Throws:
NumberFormatException

createTypedValue

@Deprecated
public static Object createTypedValue(String fieldType,
                                                 String defaultValue)
                               throws NumberFormatException
Deprecated. since 5.1. use createTypedValue(Class, String) instead.

Create a custom Field Object based on the Type and defaultValue. If the fieldType is null, the defaultValue will be returned as String or null. If the defaultValue is null, null will be returned.

Throws:
NumberFormatException - In case of the default value could not be parsed to the desired class.

createTypedValue

public static Object createTypedValue(Class<?> type,
                                      String defaultValue)
                               throws NumberFormatException
Create a custom Field Object based on the Type and defaultValue. If the fieldType is null, the defaultValue will be returned as String or null. If the defaultValue is null, null will be returned.

Throws:
NumberFormatException - In case of the default value could not be parsed to the desired class.

getFieldTypeClass

public static Class<?> getFieldTypeClass(String fieldType)
Return the related Class for a desired Type by String. Using PropertyType to read the type from the String. If no fieldType is defined, the default is String.

Throws:
IllegalArgumentException - if the Type is not supported.

getFieldTypeClass

public static Class<?> getFieldTypeClass(int fieldType)
Return the related Class for a desired Type. If no fieldType is defined, the default is String.

Throws:
IllegalArgumentException - if the Type is not supported.


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.