我尝试调查给定包中可用的类。暂时我硬编码类名,I get so many methods which are not available in the class when i try to print all the methods and parameter type the method takes
下面是我的主类,我研究了这个类和它的方法:
package com.hexgen.reflection;
`// removed imports to post question`
import com.hexgen.tools.HexgenClassUtils;
public class HexgenWebAPITest {
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
public static void main(String[] args) {
HexgenWebAPITest test = new HexgenWebAPITest();
HexgenClassUtils hexgenClassUtils = new HexgenClassUtils();
String uri="";
String[] mappingValues=null;
HttpClientRequests httpRequest = new HttpClientRequests();
Class parames = CreateRequisitionRO[].class;
Class booleanVal;
booleanVal = Boolean.TYPE;
Class cls;
try {
List classNames = hexgenClassUtils.findMyTypes("com.hexgen.*");
Iterator<Class> it = classNames.iterator();
while(it.hasNext())
{
Class obj = it.next();
System.out.println("Methods available in : "+obj.getName());
System.out.println("===================================");
if(obj.getName().equals("com.hexgen.api.facade.HexgenWebAPI")){
cls = Class.forName(obj.getName());
cls.getClass();
Method[] method = cls.getDeclaredMethods();
int i=1;
for (Method method2 : method) {
System.out.println(+i+":"+method2.getName());
Class[] parameterTypes = method2.getParameterTypes();
for (Class class1 : parameterTypes) {
System.out.println("Parameter Type : "+class1.getName());
}
i++;
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
这是Utility Class
package com.hexgen.tools;
// removed imports to post the question here
public class HexgenClassUtils {
@SuppressWarnings({ "rawtypes"})
public List<Class> findMyTypes(String basePackage) throws IOException, ClassNotFoundException
{
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver);
List<Class> candidates = new ArrayList<Class>();
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
resolveBasePackage(basePackage) + "/" + "**/*.class";
Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
for (Resource resource : resources) {
if (resource.isReadable()) {
MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
if (isCandidate(metadataReader)) {
candidates.add(Class.forName(metadataReader.getClassMetadata().getClassName()));
}
}
}
return candidates;
}
public String resolveBasePackage(String basePackage) {
return ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils.resolvePlaceholders(basePackage));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public boolean isCandidate(MetadataReader metadataReader) throws ClassNotFoundException
{
try {
Class c = Class.forName(metadataReader.getClassMetadata().getClassName());
if (!c.isInterface() && c.getAnnotation(Controller.class) != null) {
return true;
}
}
catch(Throwable e){
}
return false;
}
}
这是我正在研究的实际类:
package com.hexgen.api.facade;
`// removed imports to post question here`
import com.hexgen.datauploader.ETLServiceProvider;
import com.hexgen.ro.response.UserDetailsResponse;
/**
* Hexagon Global IT Services (ALL RIGHTS RESERVED) Created with IntelliJ IDEA.
* User: mayankk Date: 23/11/12 Time: 10:27 AM To change this template use File
* | Settings | File Templates.
*/
@Controller
@Transactional
public class HexgenWebAPI {
@Resource(name = "facadeDbFuncs")
private DbFuncs dbFuncs;
@Resource(name = "gatekeeper")
private IGateKeeper gateKeeper;
@Resource(name = "userContext")
private UserContext userContext;
@Resource(name = "costCalc")
private FinancialCalculator financialCalculator;
@Resource(name = "ytmCalc")
private YTMCalculator ytmCalc;
@Resource(name = "etlService")
private ETLServiceProvider etlService;
@Resource(name = "biManager")
private IBIManager biManager;
private String tmpFileName;
Logger logger = LoggerFactory.getLogger(HexgenWebAPI.class);
private Pattern c4Pattern;
public HexgenWebAPI() {
String cmdPattern = "([bsBS])[ ]+(\w+)[ ]+(\d+)[ ]*@[ ]*(\d+\.?\d*)";
c4Pattern = Pattern.compile(cmdPattern);
}
@RequestMapping(method = RequestMethod.GET, value = "/user/details")
public @ResponseBody
UserDetailsResponse getLoggedinUserDetails() {
HexGenUser details = (HexGenUser) SecurityContextHolder.getContext()
.getAuthentication().getPrincipal();
populateImplementationDetails(response);
return response;
}
private void populateImplementationDetails(UserDetailsResponse response) {
logger.debug("Finding revision details");
try {
CodeSource codeSource = this.getClass().getProtectionDomain()
.getCodeSource();
if (codeSource != null) {
JarInputStream jarStream = new JarInputStream(codeSource
.getLocation().openStream());
Manifest manifest = jarStream.getManifest();
logger.debug("Manifest not found!");
if (manifest != null) {
}
}
} catch (Throwable e) {
logger.debug(e.getMessage());
}
logger.debug("Could not find revision details, seems like development environment.");
}
@PreAuthorize("isAuthenticated() and hasPermission(#request, 'CREATE_REQUISITION')")
@RequestMapping(method = RequestMethod.POST, value = "/trade/createrequisition")
public @ResponseBody
void createRequisition(@RequestBody CreateRequisitionRO[] request,
@RequestHeader("validateOnly") boolean validateOnly) {
logger.debug("Starting createRequisition()...");
for (int i = 0; i < request.length; i++) {
CreateRequisitionRO requisitionRequest = request[i];
{
logger.debug("Record is for update ? {}", mr.isUpdate());
logger.debug("attrs are {}", mr.getChangedRecord());
}
gateKeeper.route(request);
}
@PreAuthorize("isAuthenticated() and hasPermission(#request, 'CREATE_ORDER')")
@RequestMapping(method = RequestMethod.POST, value = "/trade/createorder")
public @ResponseBody
void createOrder(@RequestBody CreateOrderRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
TradeDtl orderRow = dbFuncs.references.tradeDtl.findByTransId(request
.getTransRef());
d
logger.debug("Starting createOrder()...");
gateKeeper.route(request);
}
@RequestMapping(method = RequestMethod.POST, value = "/trade/confirmorder")
public @ResponseBody
void confirmOrder(@RequestBody ConfirmOrderRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
logger.debug("Starting confirmOrder()...");
gateKeeper.route(request);
}
@RequestMapping(method = RequestMethod.PUT, value = "/trade/review/approve")
public @ResponseBody
void approveReview(@RequestBody ApproveReviewRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
logger.trace("approveReview({},{})", request, validateOnly);
gateKeeper.route(request);
}
@RequestMapping(method = RequestMethod.PUT, value = "/trade/review/reject")
public @ResponseBody
void rejectReview(@RequestBody RejectReviewRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
logger.trace("HexgenWebAPI.rejectReview({},{})", request, validateOnly);
gateKeeper.route(request);
}
@RequestMapping(method = RequestMethod.PUT, value = "/upload/overwrite/approve")
public @ResponseBody
void approveUpload(@RequestBody ApproveReviewRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
logger.trace("approveUpload({},{})", request, validateOnly);
UploadJobMaster uploadJobMaster = dbFuncs.references.uploadJobMaster.findOne(request.getId());
AbstractUploadOverwriteRO uploadAcceptRO = null;
Class<?> loaderRO = null;
try {
String className = etlService.getOverwriteAcceptEventName(uploadJobMaster.getUploadGenericType());
loaderRO = Class.forName(className);
uploadAcceptRO = (AbstractUploadOverwriteRO) loaderRO.newInstance();
uploadAcceptRO.setUploadID(uploadJobMaster.getUploadId());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
gateKeeper.route((IRO) uploadAcceptRO);
}
@RequestMapping(method = RequestMethod.PUT, value = "/upload/overwrite/reject")
public @ResponseBody
void rejectUpload(@RequestBody RejectReviewRO request,
@RequestHeader("validateOnly") boolean validateOnly) {
try {
String className = etlService.getOverwriteRejectEventName(uploadJobMaster.getUploadGenericType());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
gateKeeper.route((IRO) uploadRejectRO);
}
@RequestMapping(method = RequestMethod.POST, value = "/upload/file")
public @ResponseBody
FileUploadResponse upload(@RequestParam("file") MultipartFile file) {
FileUploadResponse fileUploadResponse = new FileUploadResponse();
try {
file.transferTo(tmpFile);
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
fileUploadResponse.setStatusMessage("passed");
return fileUploadResponse;
}
@RequestMapping(method = RequestMethod.POST, value = "/upload/form/{uploadType}/{uploadName}")
public @ResponseBody
void uploadForm(@PathVariable String uploadType,
@PathVariable String uploadName) {
FileReceivedForUploadRO requisitionRequest = new FileReceivedForUploadRO(
gateKeeper.route(requisitionRequest);
}
//Reports
@PostFilter("isAuthenticated() and hasPermission(null, 'REPG' + filterObject.groupId)")
@RequestMapping(method = RequestMethod.GET, value = "/reports/groups")
public @ResponseBody
List<ReportsGroups> RetrieveReportGroups() {
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
return biManager.getReportGroups();
}
@PostFilter("isAuthenticated() and hasPermission(null, 'REPN' + filterObject.reportId)")
@RequestMapping(method = RequestMethod.GET, value = "/reports/list")
public @ResponseBody
List<ReportNames> RetrieveReports(@RequestParam("groupId") BigDecimal groupId) {
return biManager.getReportNames(groupId);
}
@PreAuthorize("isAuthenticated() and hasPermission(null, 'REPN' + #reportId)")
@RequestMapping(method = RequestMethod.GET, value = "/reports/fields")
public @ResponseBody
List<FilterParameters> RetrieveReportFields(@RequestParam("reportId") BigDecimal reportId) {
ReportGroupMapping report = dbFuncs.references.reportGroupMapping.findOne(reportId);
return biManager.getFilterParameters(report.getReportName());
}
@PreAuthorize("isAuthenticated() and hasPermission(null, 'REPN' + #request.reportId)")
@RequestMapping(method = RequestMethod.POST, value = "/reports/generateurl")
public @ResponseBody
GenerateURLResponse generateURL(@RequestBody GenerateURLRO request) {
ReportGroupMapping report = dbFuncs.references.reportGroupMapping.findOne(request.getReportId());
try {
return new GenerateURLResponse(biManager.generateURL(report.getReportName(), request.getReportParameters()));
} catch(BOValidationException e) {
throw new ValidationException(e.getViolations());
}
}
// TODO throw away code
@RequestMapping(method = RequestMethod.POST, value = "/upload/eodprocess")
public @ResponseBody
void dayChange() {
DayChangeRO dayChangeRO = new DayChangeRO();
gateKeeper.route(dayChangeRO);
}
@RequestMapping(method = RequestMethod.GET, value = "/overview/holdings")
public @ResponseBody
List<HoldingsRO> generateHoldingsReport() {
List<HoldingsQO> holdingsQO = dbFuncs.references.reportsMgrFinders
.getAllHoldings();
holdingsRO.add(new HoldingsRO(holding.getAssetClass(), holding
.getUnRealTcy(), holding.getUnRealPcy()));
}
return holdingsRO;
}
@RequestMapping(method = RequestMethod.GET, value = "/overview/funds")
public @ResponseBody
List<FundOverviewRO> generatePortfolioTrend() {
List<FundOverviewQO> fundOverviewQO = dbFuncs.references.reportsMgrFinders
.getPortfolioMovement();
List<FundOverviewRO> fundOverviewRO = new ArrayList<FundOverviewRO>();
.getLast30Day()));
}
return fundOverviewRO;
}
@RequestMapping(method = RequestMethod.GET, value = "/fund/holdings/{portfolio}")
public @ResponseBody
List<HoldingsRO> generateHoldingsReport(@PathVariable String portfolio) {
List<HoldingsQO> holdingsQO = dbFuncs.references.reportsMgrFinders
.getFundHoldings(portfolio);
List<HoldingsRO> holdingsRO = new ArrayList<HoldingsRO>();
for (HoldingsQO holding : holdingsQO) {
String securityDescription = holding.getSecurityDescription()
.substring(
0,
Math.min(holding.getSecurityDescription().length(),
20));
holdingsRO.add(new HoldingsRO(holding.getAssetClass(), holding
.getAccrIntTcy(), holding.getAodTcy(), holding
.getUnRealTcy(), holding.getUnRealPcy()));
}
return holdingsRO;
}
@RequestMapping(method = RequestMethod.GET, value = "/fund/concentration/{portfolio}")
public @ResponseBody
ConcentrationRO[] getConcentrationForFund(@PathVariable String portfolio) {
List<ConcentrationRO> concentrations = new ArrayList<ConcentrationRO>();
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getAssetGroupExposureFor(userContext.getCompany(),
portfolio)));
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getAssetClassExposureFor(userContext.getCompany(),
portfolio)));
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getIndustryExposureFor(userContext.getCompany(),
portfolio, "IND")));
return concentrations
.toArray(new ConcentrationRO[concentrations.size()]);
}
@RequestMapping(method = RequestMethod.GET, value = "/overview/concentration")
public @ResponseBody
ConcentrationRO[] getConcentrationForFund() {
List<ConcentrationRO> concentrations = new ArrayList<ConcentrationRO>();
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getAssetGroupExposureFor(userContext.getCompany())));
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getAssetClassExposureFor(userContext.getCompany())));
concentrations
.add(generateConcentrationRO(dbFuncs.references.concentrationFinders
.getIndustryExposureFor(userContext.getCompany(), "IND")));
return concentrations
.toArray(new ConcentrationRO[concentrations.size()]);
}
public ConcentrationRO generateConcentrationRO(
ConcentrationFinders concentrationFinder) {
ConcentrationRO concentrationRO = new ConcentrationRO();
for (ValueQO valueQO : concentrationFinder.getValues()) {
concentrationRO.addValue(valueQO.getName(), valueQO.getActual(),
valueQO.getGuidance());
}
return concentrationRO;
}
@RequestMapping(method = RequestMethod.POST, value = "/c4/execute")
public @ResponseBody
void executeC4Command(@RequestBody C4CommandRO request) {
logger.debug("Received command for execution : " + request.getCmd());
try {
Matcher matcher = c4Pattern.matcher(request.getCmd());
if (matcher.matches()) {
String parsedTransCode = matcher.group(1);
} else {
logger.debug("Invalid C4 command");
throw new RuntimeException();
}
} catch (Throwable e) {
logger.debug("Ooops !! C4 command execution failed - "
+ e.getMessage());
throw new RuntimeException(e);
}
}
// FIXME C4 throw away code
private void createRequisitionThroughC4(String security, String transCode,
BigDecimal price, BigDecimal quantity) {
logger.debug("Starting createRequisition() through C4...");
try {
Security securityRow = dbFuncs.references.security
.findBySecurity(security);
if (securityRow.getIsIntApplic() || securityRow.getIsDiscounted()) {
createRequisition.setYtm(ytmCalc.computeXIRR(security, price,
userContext.getBusinessDate()));
} else {
createRequisition.setYtm(BigDecimal.ZERO);
}
SystemDefault defaults = dbFuncs.references.systemDefault
.findByParamLevelAndCompanyAndDivisionAndPortfolio(
ParamLevel.PF, userContext.getCompany(),
userContext.getDivision(), portfolio);
OutputValuesFromInvestmentsDO response = financialCalculator
.costSettlementCalculator(input);
createRequisition.setTransSrlNo(BigDecimal.ONE);
if (transCode.equals("BUY")) {
createRequisition.setInflowOutflow(InflowOutflow.I);
} else {
createRequisition.setInflowOutflow(InflowOutflow.O);
}
createRequisition.setFundManager(createRequisition.getUserId());
createRequisition.setCustodianN(defaults.getCustodianN());
gateKeeper.route(createRequisition);
} catch (Throwable e) {
logger.debug("Ooops !! C4 command execution failed - "
+ e.getMessage());
throw new RuntimeException(e);
}
}
}
,但以下是我得到的输出,我看到许多方法在类中不存在:
1:ajc$get$validator
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
2:ajc$set$validator
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : javax.validation.Validator
3:ajc$get$requestToEventTranslator
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
4:ajc$set$requestToEventTranslator
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.p0.translator.RequestToEventTranslator
5:ajc$interMethodDispatch2$com_hexgen_api_facade_HexgenWebAPIValidation$validate
Parameter Type : com.hexgen.ro.IRO
6:handleValidationException
Parameter Type : com.hexgen.api.facade.ValidationException
7:createRequisition
Parameter Type : [Lcom.hexgen.ro.request.CreateRequisitionRO;
Parameter Type : boolean
8:getLoggedinUserDetails
9:populateImplementationDetails
Parameter Type : com.hexgen.ro.response.UserDetailsResponse
10:excelMDM
Parameter Type : com.hexgen.ro.request.MdmFromExcelRO
11:createOrder
Parameter Type : com.hexgen.ro.request.CreateOrderRO
Parameter Type : boolean
12:confirmOrder
Parameter Type : com.hexgen.ro.request.ConfirmOrderRO
Parameter Type : boolean
13:approveReview
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
14:rejectReview
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
15:approveUpload
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
16:rejectUpload
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
17:upload
Parameter Type : org.springframework.web.multipart.MultipartFile
18:uploadForm
Parameter Type : java.lang.String
Parameter Type : java.lang.String
19:RetrieveReportGroups
20:RetrieveReports
Parameter Type : java.math.BigDecimal
21:RetrieveReportFields
Parameter Type : java.math.BigDecimal
22:generateURL
Parameter Type : com.hexgen.ro.request.GenerateURLRO
23:dayChange
24:generateHoldingsReport
25:generateHoldingsReport
Parameter Type : java.lang.String
26:generatePortfolioTrend
27:getConcentrationForFund
Parameter Type : java.lang.String
28:getConcentrationForFund
29:generateConcentrationRO
Parameter Type : com.hexgen.core.orm.finders.repositories.ConcentrationFinders
30:executeC4Command
Parameter Type : com.hexgen.ro.request.C4CommandRO
31:createRequisitionThroughC4
Parameter Type : java.lang.String
Parameter Type : java.lang.String
Parameter Type : java.math.BigDecimal
Parameter Type : java.math.BigDecimal
32:createRequisition_aroundBody0
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : [Lcom.hexgen.ro.request.CreateRequisitionRO;
Parameter Type : boolean
33:createRequisition_aroundBody1$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : [Lcom.hexgen.ro.request.CreateRequisitionRO;
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : [Lcom.hexgen.ro.IRO;
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
34:createOrder_aroundBody2
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.CreateOrderRO
Parameter Type : boolean
35:createOrder_aroundBody3$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.CreateOrderRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
36:confirmOrder_aroundBody4
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ConfirmOrderRO
Parameter Type : boolean
37:confirmOrder_aroundBody5$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ConfirmOrderRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
38:approveReview_aroundBody6
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
39:approveReview_aroundBody7$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
40:rejectReview_aroundBody8
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
41:rejectReview_aroundBody9$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
42:approveUpload_aroundBody10
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
43:approveUpload_aroundBody11$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.ApproveReviewRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
44:rejectUpload_aroundBody12
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
45:rejectUpload_aroundBody13$advice
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : com.hexgen.ro.request.RejectReviewRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPIValidation
Parameter Type : com.hexgen.ro.IRO
Parameter Type : boolean
Parameter Type : com.hexgen.api.facade.HexgenWebAPI
Parameter Type : org.aspectj.runtime.internal.AroundClosure
46:ajc$preClinit
Spring框架的不同部分在运行时执行插装,以增加类并提供额外的功能。Spring使用三种不同的检测方法:
-
DynamicProxies——这是J2SE的一个特性,允许通过指定"方法处理程序"(一个被调用来处理方法调用的方法)"动态地"生成接口。处理程序将查看方法签名和参数,以决定要做什么。通常,这将涉及在调用实现相同接口的具体目标类的相应方法之前或之后添加圆顶功能。(因此得名"代理")。当类由接口支持时,动态代理是默认的。
-
字节码工程(BCEL)。这涉及重写在第一次需要类时加载类的类装入器方法。重写的方法返回在运行时生成的子类,并包含额外的功能。Spring使用的库是'cglib',它建立在'asm'之上…这些库优先考虑性能而不是易用性……(易用性不是一个问题,因为Spring用户自己不做任何字节码工程——只使用插装类)。
-
AspectJ编织。这涉及到使用编译时编织或运行时编织。在后一种情况下,使用一个特殊的Java代理(给JVM的命令行参数)而不是拦截类装入器。
插装的例子有基于注释的事务、安全注释、验证等。
您正在观察第二种插装类型(运行时生成的子类),这是具体类的默认类型…(AspectJ可以在更复杂的情况下使用,比如在Spring容器之外的类上提供依赖注入)。