[jboss-cvs] JBossAS SVN: r85916 - in projects/jboss-reflect/trunk: src/site/apt and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 16 07:40:10 EDT 2009


Author: stalep
Date: 2009-03-16 07:40:09 -0400 (Mon, 16 Mar 2009)
New Revision: 85916

Modified:
   projects/jboss-reflect/trunk/pom.xml
   projects/jboss-reflect/trunk/src/site/apt/index.apt
   projects/jboss-reflect/trunk/src/site/apt/usage.apt
Log:
[JBREFLECT-51]
further documentation.

Modified: projects/jboss-reflect/trunk/pom.xml
===================================================================
--- projects/jboss-reflect/trunk/pom.xml	2009-03-16 11:39:59 UTC (rev 85915)
+++ projects/jboss-reflect/trunk/pom.xml	2009-03-16 11:40:09 UTC (rev 85916)
@@ -9,7 +9,7 @@
   <version>2.2.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>JBoss Reflection</name>
-  <url>http://www.jboss.com/products/jbossmc</url>
+  <url>http://www.jboss.org/jbossreflect</url>
   <description>JBoss Reflection</description>
   <scm>
     <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-reflect/trunk/</connection>
@@ -104,6 +104,29 @@
       </plugin>
     </plugins>
   </reporting>
+  
+  <developers>
+    <developer>
+      <name>Adrian Brock</name>
+    </developer>
+    <developer>
+      <name>Bill Burke</name>
+    </developer>
+    <developer>
+      <name>Ales Justin</name>
+    </developer>
+    <developer>
+      <name>Ståle W. Pedersen</name>
+    </developer>
+  </developers>
 
+  <distributionManagement>
+    <site>
+      <id>www.jboss.org</id>
+      <name>www.jboss.org</name>
+      <!-- This should be set to a local checkout of the jboss.org/jbossretro freezone. -->
+      <url>file://${jbossreflect.site.root}</url>
+    </site>
+  </distributionManagement>
 
 </project>

Modified: projects/jboss-reflect/trunk/src/site/apt/index.apt
===================================================================
--- projects/jboss-reflect/trunk/src/site/apt/index.apt	2009-03-16 11:39:59 UTC (rev 85915)
+++ projects/jboss-reflect/trunk/src/site/apt/index.apt	2009-03-16 11:40:09 UTC (rev 85916)
@@ -2,13 +2,16 @@
 JBoss Reflect
 
    Jboss-reflect is a one-stop shop for reflection and byte-code manipulation implemented on top of 
-   javassist (or any other byte code tool).
+   javassist and java.lang.reflect (or any other byte code tool).
 
    It is designed to abstract away the implementation specific details of java.lang.reflect and 
    javassist.
    An overview over the different SPI's can be found {{{http://www.jboss.org/community/docs/DOC-13272}here}}.
 
-   JBoss Reflect also supports mutable classes
+   With the support of Javassist JBoss Reflect support mutable objects. This means that its possible to runtime
+   change classes/methods/constructors/fields. Its possible to load the changed objects in runtime or get a 
+   bytearray representation of the class which can be saved to disc and loaded later. As in Javassist its not
+   possible to change a Class that has already been loaded by the classloader.
 
 *Usage
   

Modified: projects/jboss-reflect/trunk/src/site/apt/usage.apt
===================================================================
--- projects/jboss-reflect/trunk/src/site/apt/usage.apt	2009-03-16 11:39:59 UTC (rev 85915)
+++ projects/jboss-reflect/trunk/src/site/apt/usage.apt	2009-03-16 11:40:09 UTC (rev 85916)
@@ -1,2 +1,47 @@
+---
+Usage of JBoss Reflect
+---
+Ståle W. Pedersen
+---
+09-Jan-2009
+---
 
-JBoss Reflect have implemented support for two 
+Mutable
+
+   Mutable objects in JBoss Reflect can be changed in any way the user wants, only exception is object that has
+   already been loaded and system classes.
+
+   Simple example of how we can create an object in runtime:
++----+
+MutableClassInfo mci = new JavassistTypeInfoFactory().createNewMutableClass("Pojo");
+MutableMethodInfo mmi1 = mci.createMutableMethod(new InsertBeforeJavassistBody("public String getFoo() { return \"foo\"; }"));
+mci.addMethod(mmi1);
+Class<?> PojoClass = mci.getType(); // when we create the .class representation of the object it cannot be changed anymore
++----+
+   Edit an existing object;
+   We already have a Foo object like this:
++----+
+public class Foo
+{
+  private int num = 0;
+
+  public int getNum()
+  {
+     return num;
+  }
+}
++----+
+   Lets say we want to add a method like:
++----+
+  public void setNum(int n)
+  {
+     num = n;
+  }
++----+
+   Then we can do something like:
++----+
+MutableClassInfo mci = new JavassistTypeInfoFactory().getMutable("Foo", null); // using null as cl will cause it to use the default
+MutableMethodInfo getNum = mci.createMutableMethod(new InsertBeforeJavassistBody("public int getNum() { return num;}"));
+mci.addMethod(getNum);
+      
++----+




More information about the jboss-cvs-commits mailing list