annotation

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2018 John Deng (hi.devops.io@gmail.com).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package annotation provides annotation support for HiBoot

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(object interface{}, at interface{}) (ok bool)

Contains Has is a function that check if object is the implements of specific Annotation

func ContainsChild

func ContainsChild(input *Annotations, att interface{}) (ok bool)

ContainsChild is a function that find specific annotations.

func GetValue added in v1.8.0

func GetValue(object interface{}, att interface{}) (retVal string)

GetValue is a function that get the value of a giving annotation of the object

func HasAnnotation added in v1.8.0

func HasAnnotation(object interface{}, att interface{}) (retVal bool)

HasAnnotation is a function that check if a giving annotation if presented in the object

func Inject

func Inject(ann *Annotation) (err error)

Inject inject annotations into object

func InjectAll

func InjectAll(object interface{}) (err error)

InjectAll inject annotations into object

func InjectItems

func InjectItems(annotations *Annotations) (err error)

InjectItems inject annotations into object

func IsAnnotation

func IsAnnotation(object interface{}) (yes bool)

Types

type Annotation

type Annotation struct {
	Field  *Field
	Parent *types.ReflectObject
}

func FilterIn

func FilterIn(input *Annotations, att interface{}) (annotations []*Annotation)

FilterIn is a function that filter specific annotations.

func Find

func Find(input *Annotations, att interface{}) (annotation *Annotation)

Find is a function that find specific (child) annotation

func FindAll

func FindAll(object interface{}, att interface{}) (annotations []*Annotation)

Find is a function that find specific annotation.

func FindAnnotatedMethods added in v1.6.0

func FindAnnotatedMethods(object interface{}, att interface{}) (methods []reflect.Method, annotations []*Annotation)

FindAnnotatedMethods find the annotated methods

func FindMethodAnnotation added in v1.6.0

func FindMethodAnnotation(method reflect.Method, att interface{}) (annotation *Annotation)

HasMethodAnnotation

func GetAnnotation

func GetAnnotation(object interface{}, att interface{}) (annotation *Annotation)

GetAnnotation is a function that get specific annotation of an object.

type Annotations

type Annotations struct {
	Items    []*Annotation
	Children []*Annotations
}

func GetAnnotations

func GetAnnotations(object interface{}) (annotations *Annotations)

GetAnnotations iterate annotations of a struct

type Field

type Field struct {
	StructField reflect.StructField
	Value       reflect.Value
}

annotation field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL