HHH-6133 add an additional AnnotationValue for each mocked AnnotationInstance to mark it is from xml

This commit is contained in:
Strong Liu 2011-05-12 15:42:26 +08:00 committed by Hardy Ferentschik
parent 7e999e421d
commit 0e20d34cd8
1 changed files with 8 additions and 1 deletions

View File

@ -311,7 +311,14 @@ public class MockHelper {
if ( values == null || values.length == 0 ) {
values = EMPTY_ANNOTATION_VALUE_ARRAY;
}
return AnnotationInstance.create( name, target, values );
return AnnotationInstance.create( name, target, addMockMark( values ) );
}
private static AnnotationValue[] addMockMark(AnnotationValue[] values) {
AnnotationValue[] newValues = new AnnotationValue[values.length + 1];
System.arraycopy( values, 0, newValues, 0, values.length );
newValues[values.length] = booleanValue( "isMocked", true );
return newValues;
}