pl.edu.agh.cast.data.model.property
Class PropertyHelper

java.lang.Object
  extended by pl.edu.agh.cast.data.model.property.PropertyHelper

public final class PropertyHelper
extends Object

A helper class for manipulating properties.

Author:
AGH CAST Team

Constructor Summary
PropertyHelper()
           
 
Method Summary
static MetaPropertyManager constructMetaPropertyManagerForClass(Class<? extends Identifiable> clazz)
          Returns a MetaPropertyManager initialized with MetaPermanentProperty'ies and MetaTransientProperty'ies defined (annotated) in given class.
static Collection<MetaPermanentProperty> extractMetaPermanentProperties(Class<? extends Identifiable> clazz)
          Returns a collection of MetaPermanentProperty'ies defined for given class.
static Collection<MetaTransientProperty> extractMetaTransientProperties(Class<? extends Identifiable> clazz)
          Returns a collection of MetaTransientProperty'ies defined for given class.
static boolean isValidPropertyName(String name)
          Checks if given name is a valid Property name.
static boolean verifyGetterSignature(Method method, Class<?> type)
          Checks if given method has valid getter signature for given type.
static boolean verifySetterSignature(Method method, Class<?> type)
          Checks if given method has valid setter signature for given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHelper

public PropertyHelper()
Method Detail

isValidPropertyName

public static boolean isValidPropertyName(String name)
Checks if given name is a valid Property name.

Parameters:
name - the name to check
Returns:
true if the name is valid for a property, false otherwise
Throws:
IllegalArgumentException - if given name is null

extractMetaPermanentProperties

public static Collection<MetaPermanentProperty> extractMetaPermanentProperties(Class<? extends Identifiable> clazz)
                                                                        throws PropertyAnnotationException
Returns a collection of MetaPermanentProperty'ies defined for given class.

Parameters:
clazz - class to extract permanent properties from
Returns:
collection of meta permanent properties
Throws:
PropertyAnnotationException - when property annotations are invalid

extractMetaTransientProperties

public static Collection<MetaTransientProperty> extractMetaTransientProperties(Class<? extends Identifiable> clazz)
                                                                        throws PropertyAnnotationException
Returns a collection of MetaTransientProperty'ies defined for given class.

Parameters:
clazz - class to extract transient properties from
Returns:
collection of meta transient properties
Throws:
PropertyAnnotationException - when property annotations are invalid

constructMetaPropertyManagerForClass

public static MetaPropertyManager constructMetaPropertyManagerForClass(Class<? extends Identifiable> clazz)
                                                                throws PropertyAnnotationException
Returns a MetaPropertyManager initialized with MetaPermanentProperty'ies and MetaTransientProperty'ies defined (annotated) in given class.

Parameters:
clazz - class to extract permanent and transient properties from
Returns:
MetaPropertyManager with permanent and transient properties from clazz
Throws:
PropertyAnnotationException - when property annotations are invalid

verifyGetterSignature

public static boolean verifyGetterSignature(Method method,
                                            Class<?> type)
Checks if given method has valid getter signature for given type.

Parameters:
method - the method to check
type - the expected return type
Returns:
true if method is a getter of type

verifySetterSignature

public static boolean verifySetterSignature(Method method,
                                            Class<?> type)
Checks if given method has valid setter signature for given type.

Parameters:
method - the method to check
type - the type to set
Returns:
true if method is a setter of type


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.