-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#56] Metadata Decorator Refactoring
- refactored the @EnableCaching, @Profile, @qualifier, @RequestMapping and @view decorators [work-in-progress]
- Loading branch information
Dragan Andonovski
authored and
Dragan Andonovski
committed
Sep 23, 2016
1 parent
2a4d9fb
commit ac19de2
Showing
12 changed files
with
82 additions
and
55 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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,19 +1,26 @@ | ||
import { ComponentUtil } from "./ComponentDecorator"; | ||
import { ConfigurationUtil } from "./ConfigurationDecorator"; | ||
import {ComponentUtil, ComponentDecoratorMetadata, Component} from "./ComponentDecorator"; | ||
import {ConfigurationUtil, Configuration, ConfigurationDecoratorMetadata} from "./ConfigurationDecorator"; | ||
import { DecoratorUtil, DecoratorType } from "../helpers/DecoratorUtils"; | ||
import {DecoratorHelper} from "./common/DecoratorHelper"; | ||
|
||
export function Profile(...profiles: Array<string>) { | ||
return function (target) { | ||
DecoratorUtil.throwOnWrongType(Profile, DecoratorType.CLASS, [...arguments]); | ||
ComponentUtil.throwWhenNotOnComponentClass(Profile, [...arguments]); | ||
profiles.forEach((profile) => ComponentUtil.getComponentData(target).profiles.push(profile)); | ||
profiles.forEach((profile) => { | ||
let componentDecoratorMetadata = <ComponentDecoratorMetadata> DecoratorHelper.getOwnMetadata(target, Component); | ||
componentDecoratorMetadata.profiles.push(profile); | ||
DecoratorHelper.setMetadata(target, Component, componentDecoratorMetadata); | ||
}); | ||
}; | ||
} | ||
|
||
export function ActiveProfiles(...profiles: Array<string>) { | ||
return function (target) { | ||
DecoratorUtil.throwOnWrongType(ActiveProfiles, DecoratorType.CLASS, [...arguments]); | ||
ConfigurationUtil.throwWhenNotOnConfigurationClass(ActiveProfiles, [...arguments]); | ||
ConfigurationUtil.getConfigurationData(target).activeProfiles.push(...profiles); | ||
let configurationDecoratorMetadata = <ConfigurationDecoratorMetadata> DecoratorHelper.getMetadata(target, Configuration); | ||
configurationDecoratorMetadata.activeProfiles.push(...profiles); | ||
DecoratorHelper.setMetadata(target, Configuration, configurationDecoratorMetadata); | ||
}; | ||
} |
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,10 +1,14 @@ | ||
import { ComponentUtil } from "./ComponentDecorator"; | ||
import {ComponentUtil, Component, ComponentDecoratorMetadata} from "./ComponentDecorator"; | ||
import { DecoratorType, DecoratorUtil } from "../helpers/DecoratorUtils"; | ||
import {DecoratorHelper} from "./common/DecoratorHelper"; | ||
|
||
export function Qualifier(token: Symbol) { | ||
return function (target) { | ||
DecoratorUtil.throwOnWrongType(Qualifier, DecoratorType.CLASS, [...arguments]); | ||
ComponentUtil.throwWhenNotOnComponentClass(Qualifier, [...arguments]); | ||
ComponentUtil.getAliasTokens(target).push(token); | ||
|
||
let componentDecoratorMetadata = <ComponentDecoratorMetadata> DecoratorHelper.getOwnMetadata(target, Component); | ||
componentDecoratorMetadata.aliasTokens.push(token); | ||
DecoratorHelper.setMetadata(target, Component, componentDecoratorMetadata); | ||
}; | ||
} |
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
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
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
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
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
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
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