commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich.Kleeber...@witt-weiden.de
Subject Antwort: Error when using commons ReflectionToStringBuilder - Any ideas?
Date Mon, 15 Mar 2004 11:56:30 GMT

hi,

i think you mean :

import org.apache.commons.lang.builder.ToStringBuilder;

 public String toString() {
        return ToStringBuilder.reflectionToString( this );
    }




                                                                                         
                                               
                      "White, Joshua A                                                   
                                               
                      (HTSC, CASD)"              An:       "'commons-user@jakarta.apache.org'"
<commons-user@jakarta.apache.org>         
                      <Joshua.White@theha        Kopie:                               
                                                  
                      rtford.com>                Thema:    Error when using commons ReflectionToStringBuilder
- Any ideas?               
                                                                                         
                                               
                      15.03.04 12:48                                                     
                                               
                      Bitte antworten an                                                 
                                               
                      "Jakarta Commons                                                   
                                               
                      Users List"                                                        
                                               
                                                                                         
                                               
                                                                                         
                                               




Using jdk 1.4.2_03, I have created the following simple class:



  import org.apache.commons.lang.builder.ReflectionToStringBuilder;

  public class TestObject {
      private String testAttribute = "Some Value";

      public String getTestAttribute() {
          return testAttribute;
      }

      public void setTestAttribute(String testAttribute) {
          this.testAttribute = testAttribute;
      }

      public String toString() {
          return ReflectionToStringBuilder.toString(this);

      }
  }


And I run:

  TestObject test = new TestObject();
  System.out.println(test.toString());

I receive the following error:

  java.lang.NoSuchMethodError:
org.apache.commons.lang.builder.ToStringBuilder.getObject
()Ljava/lang/Object
;
   at
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(Reflectio

nToStringBuilder.java:515)
   at
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(Reflectio

nToStringBuilder.java:265)
   at
org.apache.commons.lang.builder.ReflectionToStringBuilder.toString(Reflectio

nToStringBuilder.java:171)
   at donotcall.TestObject.toString(TestObject.java:17)
   at donotcall.TestIt.main(TestIt.java:20)
  Exception in thread "main" Process terminated with exit code 1

I have validated that I do not have another copy of commons-lang-2.0 on my
classpath.  Any suggestions?

Regards,

Joshua




This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all
copies.







---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message