net.sf.mmm.util.pojo.path.impl.function
Class PojoPathNamedFunctionToString

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.pojo.path.base.AbstractPojoPathFunction<Object,String>
              extended by net.sf.mmm.util.pojo.path.impl.function.PojoPathNamedFunctionToString
All Implemented Interfaces:
PojoPathFunction<Object,String>, PojoPathNamedFunction<Object,String>

@Singleton
@Named
public class PojoPathNamedFunctionToString
extends AbstractPojoPathFunction<Object,String>
implements PojoPathNamedFunction<Object,String>

This is the implementation of a PojoPathNamedFunction that performs a Object.toString() on the input-object.

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

Field Summary
 
Fields inherited from interface net.sf.mmm.util.pojo.path.api.PojoPathFunction
FUNCTION_NAME_PREFIX
 
Constructor Summary
PojoPathNamedFunctionToString()
          The constructor.
 
Method Summary
 String get(Object actual, String functionName, PojoPathContext context)
          This method gets the value of this function.
 Class<Object> getInputClass()
          This method gets the input-type of this function.
 String getName()
          This method gets the name of this function.
 Class<String> getValueClass()
          This method gets the output-type (or return-type) of this function.
 
Methods inherited from class net.sf.mmm.util.pojo.path.base.AbstractPojoPathFunction
create, getFunctionDescription, isDeterministic, set, toString
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
doInitialize, getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.pojo.path.api.PojoPathFunction
create, isDeterministic, set
 

Constructor Detail

PojoPathNamedFunctionToString

public PojoPathNamedFunctionToString()
The constructor.

Method Detail

getInputClass

public Class<Object> getInputClass()
This method gets the input-type of this function. It is the type of the Pojos this function operates on.

Specified by:
getInputClass in interface PojoPathFunction<Object,String>
Returns:
the input class.

getValueClass

public Class<String> getValueClass()
This method gets the output-type (or return-type) of this function. It is the type of the value this function traverses to, starting from the input-Pojo.

Specified by:
getValueClass in interface PojoPathFunction<Object,String>
Returns:
the output class.

getName

public String getName()
This method gets the name of this function.
ATTENTION:
The name has to be unique for all functions registered to a PojoPathNavigator implementation.
E.g. if the name is "foo", then the function can be invoked via "@foo" as segment.

Specified by:
getName in interface PojoPathNamedFunction<Object,String>
Returns:
the name of the function excluding the PojoPathFunction.FUNCTION_NAME_PREFIX.

get

public String get(Object actual,
                  String functionName,
                  PojoPathContext context)
This method gets the value of this function. It is invoked by PojoPathNavigator. get independent of the PojoPathMode. A regular implementation should only return what is already there. However in specific cases this may NOT (initially) be available from the given Pojo actual and therefore be retrieved from somewhere else (e.g. a database using a primary key given via a property of the given context). Further it can be legal to modify the actual Pojo e.g. by attaching the externally retrieved result.

Specified by:
get in interface PojoPathFunction<Object,String>
Overrides:
get in class AbstractPojoPathFunction<Object,String>
Parameters:
actual - is the actual Pojo where this function is invoked on. Typically the returned value should be retrieved via this object.
functionName - is the name under which this PojoPathFunction was invoked via the PojoPathNavigator excluding the PojoPathFunction.FUNCTION_NAME_PREFIX.
context - is the PojoPathContext providing additional context information. Objects traversed between actual and the returned value should be recognized via the recognizer.
Returns:
the value of this function or null if NOT available.


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