net.sf.mmm.util.pojo.path.impl.function
Class PojoPathNamedFunctionToString
java.lang.Object
net.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.pojo.path.base.AbstractPojoPathFunction<Object,String>
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)
PojoPathNamedFunctionToString
public PojoPathNamedFunctionToString()
- The constructor.
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.