[
https://issues.jboss.org/browse/LOGTOOL-91?page=com.atlassian.jira.plugin...
]
James Perkins commented on LOGTOOL-91:
--------------------------------------
So something like this?
{code:java}
@Retention(CLASS)
@Target(PARAMETER)
@Documented
public @interface Property {
/**
* The property name. If not specified, the parameter name is assumed to be the
property name.
*
* @return the property name
*/
String name() default "";
boolean booleanValue() default false;
byte byteValue() default Byte.MIN_VALUE;
char charValue() default Character.MIN_VALUE;
Class<?> classValue() default Object.class;
double doubleValue() default Double.MIN_VALUE;
float floatValue() default Float.MIN_VALUE;
int intValue() default Integer.MIN_VALUE;
long longValue() default Long.MIN_VALUE;
short shortValue() default Short.MIN_VALUE;
String stringValue() default "";
}
{code}
Add ability to provide constant values for properties
-----------------------------------------------------
Key: LOGTOOL-91
URL:
https://issues.jboss.org/browse/LOGTOOL-91
Project: Log Tool
Issue Type: Feature Request
Reporter: David Lloyd
Assignee: James Perkins
Right now I have to do this:
{code}
@Message(id = 28, value = "An unexpected protocol error occurred")
XAException protocolErrorXA(@Property int errorCode);
// ... then later ...
throw Log.log.protocolErrorXA(XAException.XAER_RMFAIL);
{code}
I'd rather be able to do this:
{code}
@Message(id = 28, value = "An unexpected protocol error occurred")
@Property(name = "errorCode", intValue = XAException.XAER_RMFAIL)
XAException protocolErrorXA();
// ... then later ...
throw Log.log.protocolErrorXA();
{code}
The same annotation ({{@Property}}) could be reused by making it multi-valued (i.e.
invisible wrapper annotation) and adding in defaulted {{xxxValue}} parameters (primitive
types, {{Class<XX>}}, and {{String}}) which are rejected when applied directly to a
method parameter.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)