hmm, this sounds good to me, we can avoid casting at least when we use an impl
of Normalizer directly.
And on a second thought I think returning Value<T> from Normalizer may not add
any value but makes the code more cluttered with checks to see if its a Sting
Value or a Binary Value
wdot?
--
Kiran Ayyagari
Felix Knecht wrote:
Kiran Ayyagari schrieb:
hi Felix,
The return type can also vary so we have to either return Object (
the current
case) or may be we can return Value<T> instead just like the way
Emmanuel
proposed to accept Value<T> as a parameter
Hmmm. I realize, that the discussion is getting deeper than what I
actually meant (but that's ok ;-) ).
Trying to make it clearer what I meant in the beginning:
For some Normalizer implementation it's absolutely clear, what kind of
type is returned for others not. Being as specific as possible why can't
we return the specific type when it's clearly defined within the method?
For all the others I agree with the Value<T> as we can be more specific.
I sorted out some of them below (and test are running fine, including
-Dintegration):
Index:
ldap/src/main/java/org/apache/directory/shared/ldap/schema/NumericNormalizer.java
===================================================================
---
ldap/src/main/java/org/apache/directory/shared/ldap/schema/NumericNormalizer.java
(revision 710036)
+++
ldap/src/main/java/org/apache/directory/shared/ldap/schema/NumericNormalizer.java
(working copy)
@@ -36,7 +36,7 @@
{
static final long serialVersionUID = 1L;
- public Object normalize( Object value ) throws NamingException
+ public String normalize( Object value ) throws NamingException
{
try
{
Index:
ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java
===================================================================
---
ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java
(revision 710036)
+++
ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java
(working copy)
@@ -39,7 +39,7 @@
{
private static final long serialVersionUID = 1L;
- public Object normalize( Object value ) throws NamingException
+ public String normalize( Object value ) throws NamingException
{
try
{
Index:
ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java
===================================================================
---
ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java
(revision 710036)
+++
ldap/src/main/java/org/apache/directory/shared/ldap/schema/BooleanNormalizer.java
(working copy)
@@ -37,7 +37,7 @@
private static final long serialVersionUID = 1L;
- public Object normalize( Object value ) throws NamingException
+ public String normalize( Object value ) throws NamingException
{
if ( value == null )
{
Felix