本文整理汇总了Java中org.aspectj.lang.Aspects类的典型用法代码示例。如果您正苦于以下问题:Java Aspects类的具体用法?Java Aspects怎么用?Java Aspects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aspects类属于org.aspectj.lang包,在下文中一共展示了Aspects类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.personRepository = new MockPersonRepository(new MockPerson());
this.objectFactory = new ObjectFactory<Person>() {
public Person getObject() {
return new MockPerson();
}
};
this.personService = new DefaultPersonService(personRepository, new MockReferenceRepository(), new MockDisclosureRecalculationStrategyRepository(), new NoOpIdentifierGenerator(), new MockReconciler(ReconciliationType.NONE));
this.personService.setIdCardGenerator(new MockIdCardGenerator());
this.personService.setPersonObjectFactory(this.objectFactory);
reconciliationCriteria = new MockReconciliationCriteria();
setReconciliationCriteria(reconciliationCriteria);
final SoRSpecificationThreadLocalAspect aspect = Aspects.aspectOf(SoRSpecificationThreadLocalAspect.class);
aspect.setSystemOfRecordRepository(new MockSystemOfRecordRepository()); }
开发者ID:Jasig,项目名称:openregistry,代码行数:18,代码来源:DefaultPersonServiceTests.java
示例2: dumpMongoTrackingStats
import org.aspectj.lang.Aspects; //导入依赖的package包/类
private void dumpMongoTrackingStats(String batchId) throws UnknownHostException {
Map<String, ? extends Map<String, Pair<AtomicLong, AtomicLong>>> stats = Aspects.aspectOf(MongoTrackingAspect.class).getStats();
if (stats != null) {
String hostName = InetAddress.getLocalHost().getHostName();
hostName = hostName.replaceAll("\\.", "#");
Update update = new Update();
update.set("executionStats." + hostName, stats);
LOG.info("Dumping runtime stats to db for job {}", batchId);
LOG.info(stats.toString());
// TODO: move to BatchJobDAO
mongo.updateFirst(new Query(Criteria.where(BATCH_JOB_ID).is(batchId)), update, "newBatchJob");
Aspects.aspectOf(MongoTrackingAspect.class).reset();
}
}
开发者ID:inbloom,项目名称:secure-data-service,代码行数:18,代码来源:CommandProcessor.java
示例3: dumpStageTrackingStats
import org.aspectj.lang.Aspects; //导入依赖的package包/类
private void dumpStageTrackingStats(String jobId) {
Map<String, Pair<AtomicLong, AtomicLong>> stats = Aspects.aspectOf(StageTrackingAspect.class).getStats();
if (stats != null) {
for (Entry<String, Pair<AtomicLong, AtomicLong>> statsEntry : stats.entrySet()) {
Stage stage = new Stage(statsEntry.getKey(), BATCH_JOB_STAGE_DESC);
stage.setElapsedTime(statsEntry.getValue().getRight().longValue());
stage.setProcessingInformation("Invocation count: " + statsEntry.getValue().getLeft().longValue());
batchJobDAO.saveBatchJobStage(jobId, stage);
}
Aspects.aspectOf(StageTrackingAspect.class).reset();
}
}
开发者ID:inbloom,项目名称:secure-data-service,代码行数:17,代码来源:CommandProcessor.java
示例4: drawGuessAspect
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Bean
public DrawGuessAspect drawGuessAspect(DrawGuess service, DrawGuessWebSocket webSocket) {
DrawGuessAspect aspect = Aspects.aspectOf(DrawGuessAspect.class);
aspect.setService(service);
aspect.setWebSocket(webSocket);
return aspect;
}
开发者ID:csdbianhua,项目名称:telemarket-skittle-alley,代码行数:8,代码来源:AspectConfig.java
示例5: args
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@After("set(@eu.crisis_economics.abm.annotation.Report * *) && args(newValue) && @annotation(newsAnnotation) && target(sender)")
public void collectField(Object newValue, eu.crisis_economics.abm.annotation.Report newsAnnotation, Object sender){
if (newsAnnotation.interval() == 0 && !(newValue instanceof Collection)){
DataCollection aspectOf = Aspects.aspectOf(DataCollection.class);
Set<Object> set = aspectOf.collectors.get(newsAnnotation.value());
if (set != null){
for (Object collector : set) {
aspectOf.handleData(newsAnnotation.value(), newValue, collector, sender, Collect.ChangeType.CHANGE);
}
}
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:13,代码来源:DataCollection.java
示例6: target
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@AfterReturning(pointcut="execution(@eu.crisis_economics.abm.annotation.Report * *(..)) && @annotation(newsAnnotation) && target(sender)", returning="returnValue")
public void collectReturnValue(Object returnValue, eu.crisis_economics.abm.annotation.Report newsAnnotation, Object sender){
if (newsAnnotation.interval() == 0){
DataCollection aspectOf = Aspects.aspectOf(DataCollection.class);
Set<Object> set = aspectOf.collectors.get(newsAnnotation.value());
if (set != null){
for (Object collector : set) {
aspectOf.handleData(newsAnnotation.value(), returnValue, collector, sender, Collect.ChangeType.CHANGE);
}
}
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:13,代码来源:DataCollection.java
示例7: removeObject
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@AfterReturning(pointcut="(addObject() || removeObject()) && dataReporterCode() && this(reporter) && args(.., arg)",
returning="result")
public void catchCollectionModification(JoinPoint jp, JoinPoint.EnclosingStaticPart enc, Object arg, Object reporter, Object result){
DataCollection aspectOf = Aspects.aspectOf(DataCollection.class);
Object targetCollection = jp.getTarget();
Class<?> dataReporterClass = enc.getSignature().getDeclaringType();
Field[] dataReporterFields = dataReporterClass.getDeclaredFields();
Collect.ChangeType changeType = jp.getSignature().getName().startsWith("add") ? ChangeType.COLLECTION_ADD : ChangeType.COLLECTION_REMOVE;
if (jp.getSignature().getName().startsWith("remove") && !(result instanceof Boolean)){
arg = result;
}
try {
for (Field field : dataReporterFields) {
field.setAccessible(true);
if (field.get(reporter) == targetCollection){
Report newsAnnotation = field.getAnnotation(Report.class);
if (newsAnnotation != null){
if (newsAnnotation.interval() == 0){
Set<Object> set = aspectOf.collectors.get(newsAnnotation.value());
if (set != null){
for (Object collector : set) {
handleData(newsAnnotation.value(), arg, collector, reporter, changeType);
}
}
}
}
}
}
} catch (IllegalAccessException e){
throw new RuntimeException(e);
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:35,代码来源:DataCollection.java
示例8: init
import org.aspectj.lang.Aspects; //导入依赖的package包/类
public static Boot init(String name) {
final Config defaultConf = ConfigFactory.load();
final Config conf;
final File confFile = new File(name + ".conf");
if(confFile.exists()) {
conf = ConfigFactory.parseFile(confFile).withFallback(defaultConf);
} else {
conf = defaultConf;
}
final Config appConfig = conf.getConfig("publisher." + name);
final ActorSystem actorSystem = ActorSystem.create(name, appConfig);
final ActorRef monitor;
if(Aspects.hasAspect(MonitorAspect.class)) {
monitor = actorSystem.actorOf(Monitor.props(), "monitor");
MonitorAspect monitorAspect = Aspects.aspectOf(MonitorAspect.class);
monitorAspect.setMonitor(monitor);
} else {
monitor = null;
}
return new Boot(appConfig, actorSystem, monitor);
}
开发者ID:IDgis,项目名称:geo-publisher,代码行数:28,代码来源:Boot.java
示例9: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(transactionManager
.getTransaction(new DefaultTransactionDefinition()))
.thenReturn(status1).thenReturn(status2);
testService = new TestService();
Aspects.aspectOf(AnnotationDrivenTransactionManagementAspect.class)
.setTransactionManager(transactionManager);
}
开发者ID:sobkowiak,项目名称:aspectj-in-action-code,代码行数:11,代码来源:TransactionManagementAspectTest.java
示例10: dataBaseSetUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void dataBaseSetUp() throws Exception {
this.simpleJdbcTemplate.update("insert into prd_identifier_types(identifier_t, name, format, private, modifiable, notifiable, deleted, description) values(null, 'NETID', 'format', false, false, true, false, 'description')");
this.simpleJdbcTemplate.update("insert into ctx_data_types(id, data_type, description) values(1, 'NAME', 'FORMAL')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(2, 'TERMINATION', 'UNSPECIFIED')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(3, 'FOO', 'Foo Description')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(4, 'TERMINATION', 'FIRED')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(5, 'SPONSOR', 'PERSON')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(6, 'AFFILIATION', 'STAFF')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(7, 'AFFILIATION', 'STUDENT')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(8, 'AFFILIATION', 'FACULTY')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(9, 'ADDRESS', 'HOME')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(10, 'ADDRESS', 'OFFICE')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(11, 'PHONE', 'LANDLINE')");
this.simpleJdbcTemplate.update("insert into ctx_data_types (id, data_type, description) values(12, 'PHONE', 'CELL')");
this.simpleJdbcTemplate.update("insert into prd_campuses(id, code, name) values(1, 'cam', 'Busch')");
this.simpleJdbcTemplate.update("insert into ctd_countries(id, code, name) values(1, 'US', 'USA')");
this.simpleJdbcTemplate.update("insert into drd_organizational_units(id, campus_id, organizational_unit_t, code, name) values(1, 1, 3, 'cod', 'Department')");
this.simpleJdbcTemplate.update("insert into drd_organizational_units(id, campus_id, organizational_unit_t, code, name) values(2, 1, 3, 'fish', 'Department')");
this.simpleJdbcTemplate.update("insert into prd_system_of_record(id, sor_id) values(1, 'test')");
// create two more SoRs
simpleJdbcTemplate.update("insert into prd_system_of_record(id, sor_id) values(1000, '"+SOR_ID1+"')");
simpleJdbcTemplate.update("insert into prd_system_of_record(id, sor_id) values(2000, '"+SOR_ID2+"')");
final SoRSpecificationThreadLocalAspect aspect = Aspects.aspectOf(SoRSpecificationThreadLocalAspect.class);
aspect.setSystemOfRecordRepository(new MockSystemOfRecordRepository());
System.out.println("Test:@@@@@@@@@@@@@@@@@@@@@@@@@@@");
}
开发者ID:Jasig,项目名称:openregistry,代码行数:31,代码来源:AbstractIntegrationTests.java
示例11: getPollableAspect
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Bean
public PollableAspect getPollableAspect() {
return Aspects.aspectOf(PollableAspect.class);
}
开发者ID:box,项目名称:mojito,代码行数:5,代码来源:PollableAspectConfig.java
示例12: getRunAsAspect
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Bean
RunAsAspect getRunAsAspect() {
return Aspects.aspectOf(RunAsAspect.class);
}
开发者ID:box,项目名称:mojito,代码行数:5,代码来源:RunAsAspectConfig.java
示例13: getJsonRawStringAspect
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Bean
public JsonRawStringAspect getJsonRawStringAspect() {
return Aspects.aspectOf(JsonRawStringAspect.class);
}
开发者ID:box,项目名称:mojito,代码行数:5,代码来源:JsonRawStringAspectConfig.java
示例14: hystrixAspect
import org.aspectj.lang.Aspects; //导入依赖的package包/类
/**
* Makes the aspect a Spring bean, eligible for receiving autowired components.
*/
@Bean
public HystrixAspect hystrixAspect() {
HystrixAspect aspect = Aspects.aspectOf(HystrixAspect.class);
return aspect;
}
开发者ID:jwilsoncredera,项目名称:spring-aop-blog,代码行数:9,代码来源:AspectJConfig.java
示例15: registerEntityWithPersistenceContext
import org.aspectj.lang.Aspects; //导入依赖的package包/类
private void registerEntityWithPersistenceContext(Object entity) {
Aspects.aspectOf(BeanListenerAspect.class).register(entity, this);
}
开发者ID:kbss-cvut,项目名称:jopa,代码行数:4,代码来源:UnitOfWorkImpl.java
示例16: deregisterEntityFromPersistenceContext
import org.aspectj.lang.Aspects; //导入依赖的package包/类
private void deregisterEntityFromPersistenceContext(Object entity) {
Aspects.aspectOf(BeanListenerAspect.class).deregister(entity);
}
开发者ID:kbss-cvut,项目名称:jopa,代码行数:4,代码来源:UnitOfWorkImpl.java
示例17: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MyAspectJTestAspect aspect = Aspects.aspectOf(MyAspectJTestAspect.class);
aspect.setOpenMon(openMon);
}
开发者ID:stevensouza,项目名称:automon,代码行数:6,代码来源:AspectJBaseTest.java
示例18: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MyAutomonTestAspect aspect = Aspects.aspectOf(MyAutomonTestAspect.class);
aspect.setOpenMon(openMon);
}
开发者ID:stevensouza,项目名称:automon,代码行数:6,代码来源:AutomonAnnotationsTest.java
示例19: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MyJamonTestAspect aspect = Aspects.aspectOf(MyJamonTestAspect.class);
aspect.setOpenMon(openMon);
}
开发者ID:stevensouza,项目名称:automon,代码行数:6,代码来源:JamonAnnotationsTest.java
示例20: setUp
import org.aspectj.lang.Aspects; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MyMetricsTestAspect aspect = Aspects.aspectOf(MyMetricsTestAspect.class);
aspect.setOpenMon(openMon);
}
开发者ID:stevensouza,项目名称:automon,代码行数:6,代码来源:MetricsAnnotationsTest.java
注:本文中的org.aspectj.lang.Aspects类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论