• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Instrospection and properties

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a class:

public class Foo
{
long ndc;
long largerNdc;
public long getLargerNdc()
{
return largerNdc;
}
public void setLargerNdc(byte b)
{
if ( b > 99 || b < 0 )
{
throw new IllegalArgumentException("Larger NDC suffix must be from 0 through 99");
}
largerNdc = (getNdc_9() * 100) + b;
}
public long getNdc_9()
{
return ndc / 100;
}
}

When I get the property descriptors, I get null for the write method:
propClass=long
writeMethod=null

Granted the 'byte' type of the setter is probably confusing Instrospector.getBeanInfo(), but I can't find anything in the API saying this could be a problem.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The return type of the getter and the argument type of the setter have to match; otherwise the getter is interpreted as a read-only property of its return type.
 
reply
    Bookmark Topic Watch Topic
  • New Topic