
META-INF.jqassistant-rules.cdi.xml Maven / Gradle / Ivy
<jqassistant-rules xmlns="http://schema.jqassistant.org/rule/v1.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.jqassistant.org/rule/v1.10 http://schema.jqassistant.org/rule/jqassistant-rule-v1.10.xsd"> <concept id="cdi:InjectionPoint"> <description>Labels all fields or methods annotated by @javax.inject.Inject with "Cdi" and "InjectionPoint".</description> <cypher><![CDATA[ MATCH (:Type)-[:DECLARES]->(member), (member)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(injectType:Type) WHERE (member:Field or member:Method) and injectType.fqn="javax.inject.Inject" SET member:Cdi:InjectionPoint RETURN member AS InjectionPoint ]]></cypher> </concept> <concept id="cdi:Produces"> <description>Creates a relation PRODUCES between a field and its type or a method and its return type if the parameter is annotated by @javax.enterprise.inject.Disposes. </description> <cypher><![CDATA[ MATCH (:Type)-[:DECLARES]->(member), (member)-[:OF_TYPE|RETURNS]->(type), (member)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(producesType:Type) WHERE (member:Field or member:Method) and producesType.fqn="javax.enterprise.inject.Produces" MERGE (member)-[:PRODUCES]->(type) RETURN member AS Producer ]]></cypher> </concept> <concept id="cdi:Disposes"> <description>Creates a relation DISPOSES between a parameter and its type if the parameter is annotated by @javax.enterprise.inject.Disposes. </description> <cypher><![CDATA[ MATCH (:Type)-[:DECLARES]->(disposeMethod:Method)-[:HAS]->(parameter:Parameter), (parameter)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(disposesType:Type), (parameter)-[:OF_TYPE]->(type) WHERE disposesType.fqn="javax.enterprise.inject.Disposes" MERGE (parameter)-[:DISPOSES]->(type) RETURN disposeMethod AS DisposeMethod ]]></cypher> </concept> <concept id="cdi:Qualifier"> <description>Labels all annotation types annotated by @javax.inject.Qualifier with "Cdi" and "Qualifier" and adds the labels "Cdi" and "Nonbinding" to all non-binding annotation values (i.e. which are annotated by @javax.enterprise.util.Nonbinding). </description> <cypher><![CDATA[ MATCH (qualifier:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(qualifierType:Type) WHERE qualifierType.fqn = "javax.inject.Qualifier" SET qualifier:Cdi:Qualifier WITH qualifier MATCH (qualifier)-[:DECLARES]->(attribute:Method), (attribute)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(nonbindingType:Type) WHERE nonbindingType.fqn = "javax.enterprise.util.Nonbinding" SET attribute:Cdi:Nonbinding RETURN distinct qualifier AS Qualifier ]]></cypher> </concept> <concept id="cdi:Dependent"> <description>Labels all beans, fields or methods annotated by @javax.enterprise.context.Dependent with "Cdi" and "Dependent".</description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(scopeType:Type) WHERE (e:Type or e:Method or e:Field) and scopeType.fqn="javax.enterprise.context.Dependent" SET e:Cdi:Dependent RETURN e AS DependentElement ]]></cypher> </concept> <concept id="cdi:RequestScoped"> <description>Labels all beans, fields or methods annotated by @javax.enterprise.context.RequestScoped with "Cdi" and "RequestScoped".</description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(scopeType:Type) WHERE (e:Type or e:Method or e:Field) and scopeType.fqn="javax.enterprise.context.RequestScoped" SET e:Cdi:RequestScoped RETURN e AS RequestScopedElement ]]></cypher> </concept> <concept id="cdi:SessionScoped"> <description>Labels all beans, fields or methods annotated by @javax.enterprise.context.SessionScoped with "Cdi" and "SessionScoped".</description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(scopeType:Type) WHERE (e:Type or e:Method or e:Field) and scopeType.fqn="javax.enterprise.context.SessionScoped" SET e:Cdi:SessionScoped RETURN e AS SessionScopedElement ]]></cypher> </concept> <concept id="cdi:ConversationScoped"> <description>Labels all beans, fields or methods annotated by @javax.enterprise.context.ConversationScoped with "Cdi" and "ConversationScoped". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(scopeType:Type) WHERE (e:Type or e:Method or e:Field) and scopeType.fqn="javax.enterprise.context.ConversationScoped" SET e:Cdi:ConversationScoped RETURN e AS ConversationScopedElement ]]></cypher> </concept> <concept id="cdi:ApplicationScoped"> <description>Labels all beans, fields or methods annotated by @javax.enterprise.context.ApplicationScoped with "Cdi" and "ApplicationScoped". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(scopeType:Type) WHERE (e:Type or e:Method or e:Field) and scopeType.fqn="javax.enterprise.context.ApplicationScoped" SET e:Cdi:ApplicationScoped RETURN e AS ApplicationScopedElement ]]></cypher> </concept> <concept id="cdi:SingletonScoped"> <description>Labels all beans annotated by @javax.inject.Singleton with "Cdi" and "SingletonScoped". </description> <cypher><![CDATA[ MATCH (t:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(a:Type) WHERE a.fqn = "javax.inject.Singleton" SET t:Cdi:SingletonScoped RETURN t AS cdiSingleton ]]></cypher> </concept> <concept id="cdi:Stereotype"> <description>Labels all annotation types annotated by @javax.enterprise.inject.Stereotype with "Cdi" and "Stereotype". </description> <cypher><![CDATA[ MATCH (stereotype:Type:Annotation)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(stereotypeType:Type) WHERE stereotypeType.fqn="javax.enterprise.inject.Stereotype" SET stereotype:Cdi:Stereotype RETURN stereotype AS Stereotype ]]></cypher> </concept> <concept id="cdi:Alternative"> <description>Labels all types annotated by @javax.enterprise.inject.Alternative with "Cdi" and "Alternative". </description> <cypher><![CDATA[ MATCH (alternative:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(alternativeType:Type) WHERE alternativeType.fqn="javax.enterprise.inject.Alternative" SET alternative:Cdi:Alternative RETURN alternative AS Alternative ]]></cypher> </concept> <concept id="cdi:Specializes"> <description>Labels all types and methods annotated by @javax.enterprise.inject.Specializes with "Cdi" and "Specializes". </description> <cypher><![CDATA[ MATCH (specializes)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(specializesType:Type) WHERE (specializes:Type or specializes:Method) and specializesType.fqn="javax.enterprise.inject.Specializes" SET specializes:Cdi:Specializes RETURN specializes AS Specialization ]]></cypher> </concept> <concept id="cdi:Delegate"> <description>Labels all fields annotated annotated by @javax.decorator.Delegate with "Cdi" and "Delegate". </description> <cypher><![CDATA[ MATCH (delegate:Field)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(delegateType:Type) WHERE delegateType.fqn="javax.decorator.Delegate" SET delegate:Cdi:Delegate RETURN delegate AS Delegate ]]></cypher> </concept> <concept id="cdi:Decorator"> <requiresConcept refId="cdi:Delegate"/> <description>Labels all types annotated by @javax.decorator.Decorator with "Cdi" and "Decorator". </description> <cypher><![CDATA[ MATCH (decorator:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(decoratorType:Type) WHERE decoratorType.fqn="javax.decorator.Decorator" SET decorator:Cdi:Decorator RETURN decorator AS Decorator ]]></cypher> </concept> <concept id="cdi:EventProducer"> <requiresConcept refId="cdi:InjectionPoint"/> <description>Labels all beans declaring "InjectionPoint" of type "javax.enterprise.event.Event" with "Cdi" and "EventProducer". </description> <cypher><![CDATA[ MATCH (a:Type)-[:DECLARES]->(member:Field:Cdi:InjectionPoint), (member)-[:OF_TYPE]->(injectType:Type) WHERE injectType.fqn = "javax.enterprise.event.Event" SET a:Cdi:EventProducer RETURN DISTINCT a.fqn AS cdiEventProducers ]]></cypher> </concept> <concept id="cdi:EventConsumer"> <requiresConcept refId="cdi:InjectionPoint"/> <description>Labels all beans declaring method that has parameter of type "javax.enterprise.event.Observes" with "Cdi" and "EventConsumer". </description> <cypher><![CDATA[ MATCH (a:Type)-[:DECLARES]->(member:Method)-[:HAS]->(param:Parameter), (param)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(injectType:Type) WHERE injectType.fqn = "javax.enterprise.event.Observes" SET a:Cdi:EventConsumer RETURN DISTINCT a.fqn AS cdiEventConsumer ]]></cypher> </concept> <concept id="cdi:Named"> <description>Labels all types or methods annotated by "javax.inject.Named" with "Cdi" and "Named". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(namedType:Type) WHERE namedType.fqn = "javax.inject.Named" SET e:Cdi:Named RETURN e AS Named ]]></cypher> </concept> <concept id="cdi:Default"> <description>Labels all elements annotated by "javax.enterprise.inject.Default" with "Cdi" and "Default". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(defaultType:Type) WHERE defaultType.fqn = "javax.enterprise.inject.Default" SET e:Cdi:Default RETURN e AS Default ]]></cypher> </concept> <concept id="cdi:Any"> <description>Labels all elements annotated by "javax.enterprise.inject.Any" with "Cdi" and "Any". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(anyType:Type) WHERE anyType.fqn = "javax.enterprise.inject.Any" SET e:Cdi:Any RETURN e AS Any ]]></cypher> </concept> <concept id="cdi:New"> <description>Labels all elements annotated by "javax.enterprise.inject.New" with "Cdi" and "New". </description> <cypher><![CDATA[ MATCH (e)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(newType:Type) WHERE newType.fqn = "javax.enterprise.inject.New" SET e:Cdi:New RETURN e AS New ]]></cypher> </concept> <constraint id="cdi:BeansMustUseConstructorInjection"> <requiresConcept refId="cdi:InjectionPoint" /> <description>All CDI beans must use constructor injection.</description> <cypher><![CDATA[ MATCH (a:Type)-[:DECLARES]->(member:Cdi:InjectionPoint) WHERE NOT member:Constructor RETURN DISTINCT a.fqn AS invalidBean ]]></cypher> </constraint> <constraint id="cdi:BeansMustNotUseFieldInjection"> <requiresConcept refId="cdi:InjectionPoint" /> <description>CDI beans shall not use field injection (constructor and setter injections are fine.).</description> <cypher><![CDATA[ MATCH (a:Type)-[:DECLARES]->(member:Field:Cdi:InjectionPoint) RETURN DISTINCT a.fqn AS invalidBean ]]></cypher> </constraint> </jqassistant-rules>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy