Get DataType of Attribute in View Object Programatically

Hi All,

In this post I am going to show you how you can get the datatype of the attribute i view object programatically.

Suppose you have a view object with name "DepartmentVO" and you want to find out what is the datatype of the attribute "DepartmentId" programatically.

To get Datatype you can use the following code.

DCBindingContainer dcBindings = 
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("DepartmentVO1Iterator");
            ViewObject vo=iterBind.getViewObject();
            AttributeDefImpl attrDef = (AttributeDefImpl)vo.findAttributeDef("DepartmentId");
            String datatype=attrDef.getJavaType().getName();

            System.out.println("Datatype=============>"+datatype);

This will give you datatype like java.lang.String, oracle.jbo.domain.Number etc.

Happy Coding :)

Comments

Popular posts from this blog

Build a Simple ReactJS application using react-cli

Customizing the ReactJS sample application created using react-cli

Setting up the environment for Angular2 and Hello World Example in Angular2