-
Notifications
You must be signed in to change notification settings - Fork 19
Customizing package and name of generated BoundBox
stephanenicolas edited this page Oct 8, 2013
·
2 revisions
When using BoundBox on a class A
, by default it will generate a class :
-
BoundBoxOfClassA
(using prefix "BoundBoxOf") inside the same package asA
- all accessors of fields will be prefixed by "boundBox" like :
boundBox_getFoo()
- the same prefix ("boundBox") will be used to generate inner class names and some other wrappers.
The prefixes used to generate a BoundBox can be configured, as well as the package of BoundBox class.
Let's say we have a class A
:
@SuppressWarnings("unused")
public class A {
private int foo = 2;
}
You can customize its BoundBox class using the annotation parameters boundBoxPackage
and prefixes
, respectively a String
and a String[]
.
public class ATest {
@BoundBox(boundClass = A.class, boundBoxPackage="foo", prefixes={"BB","bb"})
private foo.BBA boundBoxOfA;
@Before
public void setUp() {
boundBoxOfA = new foo.BBA( new A() );
}
@Test
public void testField() {
//GIVEN
//WHEN
//THEN
assertEquals( 2, boundBoxOfA.bb_getBar());
}
}
The value of prefixes
can be 1 or 2 :
- of size 2 : the first string will prefix the BoundBox class name, the second one will prefix its methods.
- of size 1 : the first string will prefix the BoundBox class name,
prefix[0].toLowerCase()
will prefix its methods.