org.apache.commons.clazz.reflect.extended
Class ReflectedMappedPropertyIntrospector

java.lang.Object
  extended by org.apache.commons.clazz.reflect.common.ReflectedPropertyIntrospectorSupport
      extended by org.apache.commons.clazz.reflect.extended.ReflectedMappedPropertyIntrospector
All Implemented Interfaces:
ReflectedPropertyIntrospector

public class ReflectedMappedPropertyIntrospector
extends ReflectedPropertyIntrospectorSupport

A ReflectedPropertyIntrospector that discovers mapped properties.

Version:
$Id: ReflectedMappedPropertyIntrospector.java 155436 2005-02-26 13:17:48Z dirkv $
Author:
Dmitri Plotnikov

Nested Class Summary
static class ReflectedMappedPropertyIntrospector.GetAccessorMethodParser
          Parser for the getFoo(key) method: Return type not void Name starts with "get" followed by capitalized singular form of the property name One parameter
static class ReflectedMappedPropertyIntrospector.KeySetAccessorMethodParser
          Parser for the getFooKeys() method: Returns integer Name starts with "get" followed by capitalized singular form of the property name, followed by "Keys" or "KeySet" No parameters
static class ReflectedMappedPropertyIntrospector.PutAccessorMethodParser
          Parser for the setFoo(key, value) method: Return type void Name starts with "set" followed by capitalized singular form of the property name Two parameters
static class ReflectedMappedPropertyIntrospector.ReadAccessorMethodParser
          Parser for the getFooMap() method: Return type not void Name starts with "get" followed by capitalized property name No parameters We don't check if the parameter is a Map here.
static class ReflectedMappedPropertyIntrospector.RemoveAccessorMethodParser
          Parser for the removeFoo(key) method: Name starts with "remove" followed by capitalized singular form of the property name One parameter
static class ReflectedMappedPropertyIntrospector.WriteAccessorMethodParser
          Parser for the setFooMap(Map) method: Return type void Name starts with "set" followed by capitalized property name One parameter We don't check if the parameter is a Map here.
 
Field Summary
protected static AccessorMethodParser GET_METHOD_PARSER
           
protected static AccessorMethodParser KEY_SET_METHOD_PARSER
           
protected static AccessorMethodParser PUT_METHOD_PARSER
           
protected static AccessorMethodParser READ_METHOD_PARSER
           
protected static AccessorMethodParser REMOVE_METHOD_PARSER
           
protected static AccessorMethodParser WRITE_METHOD_PARSER
           
 
Constructor Summary
ReflectedMappedPropertyIntrospector()
           
 
Method Summary
protected  ReflectedAccessorPairProperty createProperty(ReflectedClazz clazz, ReflectedPropertyParseResults parseResults)
          Creates a new ReflectedMappedProperty based on parse results.
protected  ReflectedMappedPropertyParseResults findBySingularName(Map parseResultMapPlural, String singularName)
          Given a singular form of a property name, locates parse results for a property with the corresponding plural name.
protected  AccessorMethodParser getGetAccessorMethodParser()
           
protected  AccessorMethodParser getKeySetAccessorMethodParser()
           
protected  ReflectedMappedPropertyParseResults getParseResults(ReflectedClazz clazz, Map parseResultMap, String propertyName)
          Finds a ReflectedMappedPropertyParseResults for the given propertyName or creates a new one and puts it in the map.
protected  AccessorMethodParser getPutAccessorMethodParser()
           
protected  AccessorMethodParser getReadAccessorMethodParser()
           
protected  AccessorMethodParser getRemoveAccessorMethodParser()
           
protected  AccessorMethodParser getWriteAccessorMethodParser()
           
 void introspectProperties(ReflectedClazz clazz, Class javaClass, Map parseResultMap)
          Goes over methods of the supplied class and creates ReflectedAccessorPairProperty objects for discovered properties.
protected  boolean isCorrectPluralSuffix(String singular, String suffix)
          Returns true if the suffix is "s" or "Map".
protected  void mergeSingularMethods(Map parseResultMapPlural, Map parseResultMapSingular)
          Combines data collected from singular methods like getFoo(key) with parse results for plural methods like getFooMap().
 
Methods inherited from class org.apache.commons.clazz.reflect.common.ReflectedPropertyIntrospectorSupport
introspectDeclaredProperties, introspectProperties, isCorrectPluralForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ_METHOD_PARSER

protected static final AccessorMethodParser READ_METHOD_PARSER

WRITE_METHOD_PARSER

protected static final AccessorMethodParser WRITE_METHOD_PARSER

GET_METHOD_PARSER

protected static final AccessorMethodParser GET_METHOD_PARSER

PUT_METHOD_PARSER

protected static final AccessorMethodParser PUT_METHOD_PARSER

REMOVE_METHOD_PARSER

protected static final AccessorMethodParser REMOVE_METHOD_PARSER

KEY_SET_METHOD_PARSER

protected static final AccessorMethodParser KEY_SET_METHOD_PARSER
Constructor Detail

ReflectedMappedPropertyIntrospector

public ReflectedMappedPropertyIntrospector()
Method Detail

introspectProperties

public void introspectProperties(ReflectedClazz clazz,
                                 Class javaClass,
                                 Map parseResultMap)
Goes over methods of the supplied class and creates ReflectedAccessorPairProperty objects for discovered properties.

Specified by:
introspectProperties in class ReflectedPropertyIntrospectorSupport

getReadAccessorMethodParser

protected AccessorMethodParser getReadAccessorMethodParser()

getWriteAccessorMethodParser

protected AccessorMethodParser getWriteAccessorMethodParser()

getGetAccessorMethodParser

protected AccessorMethodParser getGetAccessorMethodParser()

getPutAccessorMethodParser

protected AccessorMethodParser getPutAccessorMethodParser()

getRemoveAccessorMethodParser

protected AccessorMethodParser getRemoveAccessorMethodParser()

getKeySetAccessorMethodParser

protected AccessorMethodParser getKeySetAccessorMethodParser()

mergeSingularMethods

protected void mergeSingularMethods(Map parseResultMapPlural,
                                    Map parseResultMapSingular)
Combines data collected from singular methods like getFoo(key) with parse results for plural methods like getFooMap().


findBySingularName

protected ReflectedMappedPropertyParseResults findBySingularName(Map parseResultMapPlural,
                                                                 String singularName)
Given a singular form of a property name, locates parse results for a property with the corresponding plural name.


isCorrectPluralSuffix

protected boolean isCorrectPluralSuffix(String singular,
                                        String suffix)
Returns true if the suffix is "s" or "Map".

Overrides:
isCorrectPluralSuffix in class ReflectedPropertyIntrospectorSupport
See Also:
ReflectedPropertyIntrospectorSupport.isCorrectPluralSuffix(String,String)

getParseResults

protected ReflectedMappedPropertyParseResults getParseResults(ReflectedClazz clazz,
                                                              Map parseResultMap,
                                                              String propertyName)
Finds a ReflectedMappedPropertyParseResults for the given propertyName or creates a new one and puts it in the map.


createProperty

protected ReflectedAccessorPairProperty createProperty(ReflectedClazz clazz,
                                                       ReflectedPropertyParseResults parseResults)
Creates a new ReflectedMappedProperty based on parse results.

Specified by:
createProperty in class ReflectedPropertyIntrospectorSupport


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.