Re: Retrieve attribute size constraints?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Jan 31 2005 - 16:23:56 EST

  • Next message: Kevin Menard: "Re: Retrieve attribute size constraints?"

    > Hi,
    >
    > Hopefully this isn't a FAQ, but what's the most straightforward way to
    > retrieve attribute size constraints? I'm looking to use Tapestry's
    > validating form components, and it'd be pretty nifty if I could set
    > min/max size for text input based upon what the underlying DB is
    > expecting.
    >
    > Thanks,
    > Kevin

    Attribute sizes are stored in DbAttributes. So you can do something like
    that:

    DataOject object;
    String property;
    DataContext context;

    ObjEntity objEntity = context.getEntityResolver().lookupObjEntity(object);
    ObjAttribute objAttribute = (ObjAttribute) objEntity.getAttribute(property);
    int maxLength = objAttribute.getDbAttribute().getMaxLength();

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Jan 31 2005 - 16:23:58 EST