Beamable SDK
Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Beamable.Common.Reflection.AttributeOfInterest Struct Reference

Struct that defines an attribute of interest and gives us information on where to look for it. More...

Public Member Functions

bool TryGetFromMemberInfo (MemberInfo info, out Attribute attribute)
 Tries to get an attribute from the given member info. Has a guard against passing in members whose MemberInfo.MemberType don't respect INTERNAL_TYPE_SEARCH_WHEN_IS_MEMBER_TYPES.
 
bool CanBeFoundInType (Type type)
 Checks if the given type should have it's declared members searched for the given attribute.
 
 AttributeOfInterest (Type attributeType, Type[] foundInTypesWithAttributes=null, Type[] foundInBaseTypes=null)
 Constructs a new AttributeOfInterest with guards against incorrect usage. More...
 

Public Attributes

readonly Type AttributeType
 Type of the attribute you are interested in.
 
readonly AttributeTargets Targets
 Over which types of language constructs the attribute can be found. To use ReflectionCache to find attributes, the attributes MUST have an AttributeUsageAttribute on them. This allows us some performance optimizations to make this interfere less with your editor experience.
 
readonly List< Type > FoundInBaseTypes
 List of all base types whose implementations we should look through the members to find this attribute. Only relevant if TargetsDeclaredMember returns true.
 
readonly List< Type > FoundInTypesWithAttributes
 List of all attribute types whose user types (classes/structs that have the attribute over them) we should look through the members to find this attribute. Only relevant if TargetsDeclaredMember returns true.
 

Static Public Attributes

const AttributeTargets INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS
 Mask for all possible AttributeTargets declaring an attribute must only exist on a "Member" of classes/structs. More...
 
const MemberTypes INTERNAL_TYPE_SEARCH_WHEN_IS_MEMBER_TYPES
 Mask for all possible MemberTypes that can be "Members" of declared classes/structs. More...
 

Properties

bool TargetsDeclaredMember [get]
 Whether or not the attribute targets a Non-Type-Member (see INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS and INTERNAL_TYPE_SEARCH_WHEN_IS_MEMBER_TYPES).
 

Detailed Description

Struct that defines an attribute of interest and gives us information on where to look for it.

Constructor & Destructor Documentation

◆ AttributeOfInterest()

Beamable.Common.Reflection.AttributeOfInterest.AttributeOfInterest ( Type  attributeType,
Type[]  foundInTypesWithAttributes = null,
Type[]  foundInBaseTypes = null 
)
inline

Constructs a new AttributeOfInterest with guards against incorrect usage.

Parameters
attributeTypeThe Attribute's type. Expects to have AttributeUsageAttribute with correctly declared AttributeTargets.
Parameters
foundInTypesWithAttributesOnly relevant when AttributeOfInterest.Targets match INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS. List of attributes types whose using types (classes/structs that use the attributes) should be have their members searched for the attributeType .
foundInBaseTypesOnly relevant when AttributeOfInterest.Targets match INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS. List of types whose subclasses should be have their members searched for the attributeType .
Exceptions
ArgumentExceptionThrown if attributeType does not have a AttributeUsageAttribute or if TargetsDeclaredMember and both foundInBaseTypes and foundInTypesWithAttributes have no types.

Member Data Documentation

◆ INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS

const AttributeTargets Beamable.Common.Reflection.AttributeOfInterest.INTERNAL_TYPE_SEARCH_WHEN_ATTRIBUTE_TARGETS
static
Initial value:
= AttributeTargets.Constructor |
AttributeTargets.Event |
AttributeTargets.Field |
AttributeTargets.Method |
AttributeTargets.Property

Mask for all possible AttributeTargets declaring an attribute must only exist on a "Member" of classes/structs.

◆ INTERNAL_TYPE_SEARCH_WHEN_IS_MEMBER_TYPES

const MemberTypes Beamable.Common.Reflection.AttributeOfInterest.INTERNAL_TYPE_SEARCH_WHEN_IS_MEMBER_TYPES
static
Initial value:
= MemberTypes.Constructor |
MemberTypes.Event |
MemberTypes.Field |
MemberTypes.Method |
MemberTypes.Property

Mask for all possible MemberTypes that can be "Members" of declared classes/structs.


The documentation for this struct was generated from the following file: