On Wed, Aug 3, 2016 at 9:29 AM, Alexandru Cotiuga <
[email protected]> wrote:

> Hello Dan,
>
> To find out what is the data type of a field you need to get the its class
> with $field.class and depending on your needs, you can have something like:
>   $field  (1)
>   $field.class (class java.lang.Integer)
>   $field.class.name (java.lang.Integer)
>   $field.class.simpleName (Integer)
>

If by "field" Dan means the property of an object attached to a wiki page

#set ($field =
$xwiki.getDocument('Blog.BlogIntroduction').getObject('Blog.BlogPostClass').getProperty('publishDate'))

then the field type can be obtained from the XClass

#set ($fieldType =
$xwiki.getDocument('Blog.BlogPostClass').getxWikiClass().get('publishDate'))
$fieldType.classType
$fieldType.type

This is documented at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsinapage
.

Hope this helps,
Marius


>
> Hope this is what you need,
> Alex
>
> On Wed, Aug 3, 2016 at 2:07 AM, dullfig <[email protected]> wrote:
>
> > hello:
> >
> > This seems like a simple question, but I looked through the API and
> > couldn't
> > igure it out. How do you get the data type of a field? is there a way to
> > know from velocity if a field is a text field, number, date, etc?
> >
> > Dan
> >
> >
> >
> > --
> > View this message in context:
> >
> http://xwiki.475771.n2.nabble.com/How-to-get-property-data-type-tp7600548.html
> > Sent from the XWiki- Users mailing list archive at Nabble.com.
> > _______________________________________________
> > users mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/users
> >
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to