lib-utils-ts
Version:
<img src="https://img.shields.io/npm/v/lib-utils-ts"/> <img src="https://img.shields.io/snyk/vulnerabilities/npm/lib-utils-ts"/> <img src="https://img.shields.io/npm/l/lib-utils-ts"/> <img src="https://img.shields.io/github/languages/top/devGnode/lib-util
38 lines (34 loc) • 1.09 kB
text/typescript
import { AttributeDecorator} from "./Interfaces";
import {AnnotationHandlers} from "./AnnotationHandlers";
import {Annotation} from "./Annotation";
import {Constructor} from "../Constructor";
/****
* @Annotation
* @Json.JsonAttribute
*/
export class Json extends Annotation{
attributeName:string;
defaultValue:Object;
type:Constructor<any>;
protected constructor(attributeName:string, defaultValue:Object = null, type:Constructor<any> = null) {
super(Json.class().getName());
this.attributeName = attributeName;
this.defaultValue = defaultValue;
this.type = type;
}
/***
* @Annotation : @Nested.NestedClass
* @param {string} property
* @param defaultValue
* @param type
* @constructor
*/
public static JsonAttribute<T extends Object>(
property:string,
defaultValue:Object = null ,
type:Constructor<any> = null
):AttributeDecorator{
return AnnotationHandlers.annotationAttribute<Json>(Json.class(), ...arguments );
}
}
Object.package(this);