Object instantiateOrGet ( final ClassInfo annotationClassInfo , final String paramName ) { final boolean instantiate = annotationClassInfo != null ; if ( enumValue != null ) { return instantiate ? enumValue . loadClassAndReturnEnumValue ( ) : enumValue ; } else if ( classRef != null ) { return instantiate ? classRef . loadClass ( ) : classRef ; } else if ( annotationInfo != null ) { return instantiate ? annotationInfo . loadClassAndInstantiate ( ) : annotationInfo ; } else if ( stringValue != null ) { return stringValue ; } else if ( integerValue != null ) { return integerValue ; } else if ( longValue != null ) { return longValue ; } else if ( shortValue != null ) { return shortValue ; } else if ( booleanValue != null ) { return booleanValue ; } else if ( characterValue != null ) { return characterValue ; } else if ( floatValue != null ) { return floatValue ; } else if ( doubleValue != null ) { return doubleValue ; } else if ( byteValue != null ) { return byteValue ; } else if ( stringArrayValue != null ) { return stringArrayValue ; } else if ( intArrayValue != null ) { return intArrayValue ; } else if ( longArrayValue != null ) { return longArrayValue ; } else if ( shortArrayValue != null ) { return shortArrayValue ; } else if ( booleanArrayValue != null ) { return booleanArrayValue ; } else if ( charArrayValue != null ) { return charArrayValue ; } else if ( floatArrayValue != null ) { return floatArrayValue ; } else if ( doubleArrayValue != null ) { return doubleArrayValue ; } else if ( byteArrayValue != null ) { return byteArrayValue ; } else if ( objectArrayValue != null ) { // Get the element type of the array final Class < ? > eltClass = instantiate ? ( Class < ? > ) getArrayValueClassOrName ( annotationClassInfo , paramName , /* getClass = */ true ) : null ; // Allocate array as either a generic Object[] array, if the element type could not be determined, // or as an array of specific element type, if the element type was determined. final Object annotationValueObjectArray = eltClass == null ? new Object [ objectArrayValue . length ] : Array . newInstance ( eltClass , objectArrayValue . length ) ; // Fill the array instance. for ( int i = 0 ; i < objectArrayValue . length ; i ++ ) { if ( objectArrayValue [ i ] != null ) { // Get the element value (may also cause the element to be instantiated) final Object eltValue = objectArrayValue [ i ] . instantiateOrGet ( annotationClassInfo , paramName ) ; // Store the possibly-instantiated value in the array Array . set ( annotationValueObjectArray , i , eltValue ) ; } } return annotationValueObjectArray ; } else { return null ; } }
Instantiate or get the wrapped value .