Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…esting in NMS.ActiveMQ
  • Loading branch information
Timothy A. Bish committed Nov 1, 2011
1 parent d0a6021 commit a269757
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/main/csharp/Util/MessagePropertyIntercepter.cs
Expand Up @@ -55,28 +55,35 @@ protected override object GetObjectProperty(string name)
{
PropertyInfo propertyInfo = this.messageType.GetProperty(name, publicBinding);

if(null != propertyInfo && propertyInfo.CanRead)
{
return propertyInfo.GetValue(this.message, null);
}
else
{
FieldInfo fieldInfo = this.messageType.GetField(name, publicBinding);

if(null != fieldInfo)
if(name.StartsWith("NMS"))
{
if(null != propertyInfo && propertyInfo.CanRead)
{
return fieldInfo.GetValue(this.message);
return propertyInfo.GetValue(this.message, null);
}
else
{
FieldInfo fieldInfo = this.messageType.GetField(name, publicBinding);

if(null != fieldInfo)
{
return fieldInfo.GetValue(this.message);
}
}
}

return base.GetObjectProperty(name);
}

protected override void SetObjectProperty(string name, object value)
{
PropertyInfo propertyInfo = this.messageType.GetProperty(name, publicBinding);

if(null != propertyInfo && propertyInfo.CanWrite)
if(!name.StartsWith("NMS"))
{
base.SetObjectProperty(name, value);
}
else if(null != propertyInfo && propertyInfo.CanWrite)
{
propertyInfo.SetValue(this.message, value, null);
}
Expand Down

0 comments on commit a269757

Please sign in to comment.