[
https://issues.apache.org/jira/browse/QPID-7066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15197075#comment-15197075
]
Lorenz Quack commented on QPID-7066:
------------------------------------
Nice. I of course agree that this is better than doing runtime checks.
* The method looks very convoluted. The first if-for-if-for cascade just to get
to an annotation attribute seems excessive. Could you not use something like
this {code}ManagedAttribute managedAttributeAnnotation =
methodElement.getAnnotation(ManagedAttribute.class);
if (!"".equals(managedAttributeAnnotation.validValuePattern())
{ ... } {code}
* I think it would be more consistent to pass the annotation {{TypeElement}} as
in the other check* methods rather than the annotation name.
* In AttributeAnnotationValidator.java line 126 you can use the var
elementUtils defined in line 117 or even better use the {{equalType}} method.
* {{returnType}} is defined in an awkward place. I would suggest moving it
closer to where it is used (one nesting level deeper) or outside the loops to
not repeatedly call {{methodElement.getReturnType()}}. Similarly for
{{stringType}}, {{collectionType}}, and {{returnTypeElement}}
* I find it easier to reason about a logical boolean expression of the form
{code} (!A || !B || !C) {code} than one of the equivalent form {code} !(A && B
&& C) {code} but maybe that is just me.
> [Java Broker] Add a validValuePattern attribute to ManagedAttribute
> -------------------------------------------------------------------
>
> Key: QPID-7066
> URL: https://issues.apache.org/jira/browse/QPID-7066
> Project: Qpid
> Issue Type: Improvement
> Components: Java Broker
> Reporter: Rob Godfrey
> Assignee: Rob Godfrey
> Priority: Minor
> Fix For: qpid-java-6.1
>
>
> Currently there is no way to convey through meta data that an attribute value
> must conform to a particular pattern (for instance in the case of a hostname
> or ip address).
> Where a managed attribute is of type String, the regex can be used both
> client and server side to validate the input. Client side validation will
> also always need to take into account that it is always legal to insert a
> context variable reference into the value... and where such a context
> injection is present is is effectively impossible to correctly validate on
> the client side.
> For attributes which are of type Collection<String>, List<String> or
> Set<String> the validValuePattern can be taken to be referring to the
> validation applied to each element of the collection.
> The annotation information should also be conveyed through the metadataservlet
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]