net.sf.mmm.util.pojo.descriptor.base.accessor
Class AbstractPojoPropertyAccessorBuilder<ACCESSOR extends PojoPropertyAccessor>

java.lang.Object
  extended by net.sf.mmm.util.pojo.descriptor.base.accessor.AbstractPojoPropertyAccessorBuilder<ACCESSOR>
Type Parameters:
ACCESSOR - is the type of the accessor
All Implemented Interfaces:
PojoPropertyAccessorBuilder<ACCESSOR>
Direct Known Subclasses:
PojoPropertyAccessorAddBuilder, PojoPropertyAccessorGetBuilder, PojoPropertyAccessorGetIndexedBuilder, PojoPropertyAccessorGetMappedBuilder, PojoPropertyAccessorRemoveBuilder, PojoPropertyAccessorSetBuilder, PojoPropertyAccessorSetIndexedBuilder, PojoPropertyAccessorSetMappedBuilder, PojoPropertyAccessorSizeBuilder

public abstract class AbstractPojoPropertyAccessorBuilder<ACCESSOR extends PojoPropertyAccessor>
extends Object
implements PojoPropertyAccessorBuilder<ACCESSOR>

This is an abstract base implementation of the PojoPropertyAccessorBuilder interface.
It provides some helpful methods that make it easier to write implementations.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Constructor Summary
AbstractPojoPropertyAccessorBuilder()
          The constructor.
 
Method Summary
protected  String getPropertyName(String methodName, int prefixLength, int suffixLength)
          This method gets the according property-name for the given methodName.
protected  String getPropertyName(String methodName, String[] prefixes, String[] suffixes)
          This method gets the according property-name for the given methodName.
protected  String getPropertyName(String methodName, String prefix, String suffix)
          This method gets the according property-name for the given methodName.
protected static boolean isBooleanType(Class<?> type)
          This method determines if the given type is a boolean type ( boolean.class or Boolean.class).
protected static boolean isIntegerType(Class<?> type)
          This method determines if the given type is an integer type ( int.class or Integer.class).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.pojo.descriptor.base.accessor.PojoPropertyAccessorBuilder
create, create, getMode
 

Constructor Detail

AbstractPojoPropertyAccessorBuilder

public AbstractPojoPropertyAccessorBuilder()
The constructor.

Method Detail

isBooleanType

protected static boolean isBooleanType(Class<?> type)
This method determines if the given type is a boolean type ( boolean.class or Boolean.class).

Parameters:
type - is the class to check.
Returns:
true if type represents a boolean, false otherwise.

isIntegerType

protected static boolean isIntegerType(Class<?> type)
This method determines if the given type is an integer type ( int.class or Integer.class).

Parameters:
type - is the class to check.
Returns:
true if type represents an integer, false otherwise.

getPropertyName

protected String getPropertyName(String methodName,
                                 String[] prefixes,
                                 String[] suffixes)
This method gets the according property-name for the given methodName.
This is the un-capitalized substring of the methodName after between the given prefix and suffix.

Parameters:
methodName - is the name of the accessor-method.
prefixes - is an array with all possible prefixes (e.g. "get", "is", "has"). May also be empty array instead of {""}.
suffixes - is an array with all possible suffixes (e.g. "Size", "Length", "Count"). May also be empty array instead of {""}.
Returns:
the requested property-name or null if NOT available. (methodName does NOT start with one of the prefixes or does NOT end with one of the suffixes).

getPropertyName

protected String getPropertyName(String methodName,
                                 String prefix,
                                 String suffix)
This method gets the according property-name for the given methodName.
This is the un-capitalized substring of the methodName after between the given prefix and suffix.

Parameters:
methodName - is the name of the accessor-method.
prefix - is the prefix (e.g. "get", "set" or "is").
suffix - is the suffix (e.g. "" or "Size").
Returns:
the requested property-name or null if NOT available. (methodName does NOT start with prefix or does NOT end with suffix).

getPropertyName

protected String getPropertyName(String methodName,
                                 int prefixLength,
                                 int suffixLength)
This method gets the according property-name for the given methodName.
This is the un-capitalized substring of the methodName after the prefix (given via prefixLength).

Parameters:
methodName - is the name of the accessor-method.
prefixLength - is the length of the method prefix (e.g. 3 for "get"/"set" or 2 for "is").
suffixLength - is the length of the method suffix (e.g. 4 for "Size").
Returns:
the requested property-name or null if NOT available
(methodName.length() <= prefixLength).


Copyright © 2001-2010 mmm-Team. All Rights Reserved.