forked from xlorne/COLA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
6 additions
and
144 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
cola-framework/cola-core/src/main/java/com/alibaba/cola/domain/DomainFactory.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
cola-framework/cola-core/src/main/java/com/alibaba/cola/domain/DomainFactoryHelper.java
This file was deleted.
Oops, something went wrong.
38 changes: 6 additions & 32 deletions
38
cola-framework/cola-core/src/main/java/com/alibaba/cola/domain/DomainObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,25 @@ | ||
package com.alibaba.cola.domain; | ||
|
||
import com.alibaba.cola.common.ApplicationContextHelper; | ||
import com.alibaba.cola.event.EventBus; | ||
import com.alibaba.cola.repository.RepositoryBus; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author lorne | ||
* @date 2020/1/23 | ||
* @description | ||
*/ | ||
public abstract class DomainObject extends EntityObject { | ||
|
||
protected EventBus eventBus; | ||
|
||
protected RepositoryBus repositoryBus; | ||
protected static EventBus eventBus; | ||
|
||
public final void initEventBus(EventBus eventBus){ | ||
this.eventBus = eventBus; | ||
} | ||
protected static RepositoryBus repositoryBus; | ||
|
||
public final void initPresentationBus(RepositoryBus repositoryBus){ | ||
this.repositoryBus = repositoryBus; | ||
static { | ||
eventBus = ApplicationContextHelper.getBean(EventBus.class); | ||
repositoryBus = ApplicationContextHelper.getBean(RepositoryBus.class); | ||
} | ||
|
||
public void execute(){} | ||
|
||
public final <T extends DomainObject> T createDomain(Class<T> clazz, Object ... initargs) { | ||
List<Class<?>> list =null; | ||
if(initargs!=null){ | ||
list = new ArrayList<>(); | ||
for (Object obj:initargs){ | ||
list.add(obj.getClass()); | ||
} | ||
} | ||
Class<?>[] parameterTypes = list!=null?list.toArray(new Class[]{}):null; | ||
try { | ||
DomainObject domain = clazz.getDeclaredConstructor(parameterTypes).newInstance(initargs); | ||
domain.initEventBus(eventBus); | ||
domain.initPresentationBus(repositoryBus); | ||
return (T)domain; | ||
} catch (InstantiationException | IllegalAccessException | | ||
InvocationTargetException | NoSuchMethodException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
} |
11 changes: 0 additions & 11 deletions
11
cola-framework/cola-core/src/main/java/com/alibaba/cola/domain/DomainObjectFactoryI.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
cola-framework/cola-core/src/main/java/com/alibaba/cola/executor/AbsDomainExecutor.java
This file was deleted.
Oops, something went wrong.