Package java.lang.reflect

Examples of java.lang.reflect.Method


      Node xml = null;
      oneInput[0] = Class.forName("java.lang.String");
      twoInputs[0] = Class.forName("java.lang.String");
      twoInputs[1] = Class.forName("java.lang.String");

      Method method = null;

      if (attr.getNamedItem("aatocv").getNodeValue().equals("getIDFromEXID"))
      {
        xml = list.item(0);
        argList[0] = attr.getNamedItem("table").getNodeValue();
        argList[1] = getRecord(xml.toString(), TAG_LISTID);
        method = thisClass.getMethod("getIDFromEXID", twoInputs);
        ret = method.invoke(thisObj, argList);

        if (ret != null)
        {
          Object arg[] = new Object[1];

          arg[0] = getObjectByName(attr.getNamedItem("type").getNodeValue(), ret.toString());
          oneInput[0] = getArgType(attr.getNamedItem("type").getNodeValue());

          method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
          method.invoke(objectCV, arg);
        }
      } else if (attr.getNamedItem("aatocv").getNodeValue().equals("getValueFromTags"))
      {
        Object arg[] = new Object[1];
        xml = list.item(0);
        arg[0] = getRecord(xml.toString(), tagName);
        oneInput[0] = getArgType("java.lang.String");
        method = thisClass.getMethod(attr.getNamedItem("aatocv").getNodeValue(), oneInput);

        ret = method.invoke(thisObj, arg);
        arg[0] = (String)ret;

        method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
        method.invoke(objectCV, arg);
      } else if (attr.getNamedItem("aatocv").getNodeValue().equals("getItemLinesFromTags"))
      {
        oneArg[0] = getItemLinesFromTags(list);
        oneInput[0] = Class.forName(attr.getNamedItem("type").getNodeValue());
        method = classCV[0].getMethod(attr.getNamedItem("set").getNodeValue(), oneInput);
        method.invoke(objectCV, oneArg);

      } else
      {
        xml = list.item(0);
        oneInput[0] = getArgType(attr.getNamedItem("type").getNodeValue());
        oneArg[0] = getRecord(xml.toString(), TAG_LISTID);
        method = classCV[0].getMethod(attr.getNamedItem("aatocv").getNodeValue(), oneInput);
        method.invoke(objectCV, oneArg);
      }

    } catch (Exception e)
    {
      logger.error("[setAAtoCV] QBXML TAG: <" + tagName + ">", e);
View Full Code Here


      Object argList[] = new Object[2];
      Object ret = null;

      twoInputs[0] = Class.forName("java.lang.String");

      Method method = null;
      String tmpXML = "";

      if (attr.getNamedItem("cvtoaa").getNodeValue().equals("getEXIDFromID"))
      {
        method = classCV[0].getMethod(attr.getNamedItem("get").getNodeValue(), null);
        ret = method.invoke(objectCV, null);

        if (ret != null)
        {
          argList[0] = attr.getNamedItem("table").getNodeValue();
          argList[1] = getObjectByName("int", ret.toString());

          twoInputs[1] = Integer.TYPE;
          method = thisClass.getMethod("getEXIDFromID", twoInputs);
          ret = method.invoke(thisObj, argList);

          if (ret != null)
          {
            if (!ret.toString().equals(""))
              tmpXML = "<" + tagName + "> \n" + "<" + TAG_LISTID + ">" + ret + "</" + TAG_LISTID + ">" + "</" + tagName + "> \n";
          }
        }
      } else if (attr.getNamedItem("cvtoaa").getNodeValue().equals("getTagsFromItemLines"))
      {
        ItemLines itemLines = null;
        method = classCV[0].getMethod("getItemLines", null);
        itemLines = (ItemLines)method.invoke(objectCV, null);
        tmpXML = getTagsFromItemLines(itemLines, tagName);
      } else
      {
        method = classCV[0].getMethod(attr.getNamedItem("get").getNodeValue(), null);
        ret = method.invoke(objectCV, null);

        Object arg[] = new Object[1];

        if (ret != null)
        {
          oneInput[0] = getArgType("java.lang.String");
          arg[0] = getObjectByName("java.lang.String", ret.toString());

          method = thisClass.getMethod(attr.getNamedItem("cvtoaa").getNodeValue(), oneInput);
          ret = method.invoke(thisObj, arg);
          if (!ret.toString().equals(""))
            tmpXML = "<" + tagName + "> \n" + ret.toString() + "</" + tagName + "> \n";
        }
      }
      retXML = tmpXML;
View Full Code Here

   */
  public void forward(Object objectCV, NamedNodeMap attr, Node xml, Class classCV[], String className, Document config)
  {
    try
    {
      Method method = null;
      Object obj = null;
      String classNameField = "";
      Class argumentType[] = null;

      Node get = attr.getNamedItem("get");

      if (get == null)
      {
        next(objectCV, config.getFirstChild(), xml, className, attr);
      } else
      {
        classNameField = attr.getNamedItem("type").getNodeValue();
        method = classCV[0].getMethod(get.getNodeValue(), argumentType);
        obj = method.invoke(objectCV, argumentType);

        next(obj, config.getFirstChild(), xml, classNameField, attr);
      }
    } catch (Exception e)
    {
View Full Code Here

    Class classCV[] = new Class[1];
    Class argumentType[] = new Class[1];
    Object arguments[] = new Object[1];

    Method method = null;
    int length = listItem.getLength();

    String typeArg = "";
    String value = "";
    String tagName = "";

    Node node = att.getNamedItem("isprimary");
    try
    {
      classCV[0] = Class.forName(className);
      if (node != null)
      {
        argumentType[0] = Class.forName("java.lang.String");
        Method setPrim = classCV[0].getMethod("setIsPrimary", argumentType);
        arguments[0] = node.getNodeValue();
        setPrim.invoke(objectCV, arguments);
      }

      for (int i = 0; i < length; i++)
      {
        tagName = listItem.item(i).getNodeName();
View Full Code Here

  {
    String retXML = "";

    try
    {
      Method method = null;
      Object obj = null;
      String classNameField = "";
      Class argumentType[] = null;

      Node get = attr.getNamedItem("get");

      if (get == null)
      {
        retXML = nextXML(objectCV, config.getFirstChild(), className);
      } else
      {
        classNameField = attr.getNamedItem("type").getNodeValue();
        method = classCV[0].getMethod(get.getNodeValue(), argumentType);
        obj = method.invoke(objectCV, argumentType);
        retXML = nextXML(obj, config.getFirstChild(), classNameField);
      }
    } catch (Exception e)
    {
      logger.error("[forwardXML] Exception thrown.", e);
View Full Code Here

    {

      Document configForQBXML;

      Object ret = null;
      Method method = null;
      String value = "";
      Class classCV[] = new Class[1];

      StringTokenizer st;
      String tmp = "";
      String tmpXML = "";
      String className = getValueOfNodeByTagName(configXML, TAG_VONAME);
      classCV[0] = Class.forName(className);

      Node met = null;
      NodeList listItem = configXML.getChildNodes();

      int length = listItem.getLength();

      for (int i = 0; i < length; i++)
      {

        tagName = listItem.item(i).getNodeName();

        if (tagName.equals("#text") || !listItem.item(i).hasAttributes())
          continue;

        NamedNodeMap attr = listItem.item(i).getAttributes();

        if (attr.getNamedItem("cvtoaa") != null)
        {
          tmpXML = getAAfromCV(objectCV, attr, classCV, tagName);

          if (!tmpXML.trim().equals(""))
            xml += tmpXML;

          continue;
        }

        if (attr.getNamedItem("xml") != null)
        {
          configForQBXML = getDocumentFromString(getDocumentFromString(attr.getNamedItem("xml").getNodeValue()).getElementsByTagName(attr.getNamedItem("tag").getNodeValue()).item(0).toString());

          tmpXML = forwardXML(classCV, attr, objectCV, className, configForQBXML);

          if (!tmpXML.trim().equals(""))
            xml += "<" + tagName + ">" + tmpXML + "</" + tagName + "> \n";

          continue;
        }
        met = attr.getNamedItem("get");
        method = classCV[0].getMethod(met.getNodeValue(), null);
        ret = method.invoke(objectCV, null);

        if (ret != null)
        {
          value = ret.toString();
          if (met.getNodeValue().equalsIgnoreCase("getExternalID"))
View Full Code Here

  {
    String retxml = "";

    try
    {
      Method method = null;

      String tagName = "";
      String value = "";
      String tmpXML = "";

      Class classCV[] = new Class[1];
      classCV[0] = Class.forName(className);

      NodeList listItem = configXML.getChildNodes();

      int length = listItem.getLength();

      for (int i = 0; i < length; i++)
      {
        tagName = listItem.item(i).getNodeName();

        if (tagName.equals("#text"))
          continue;

        NamedNodeMap attr = listItem.item(i).getAttributes();

        if (attr.getNamedItem("cvtoaa") != null)
        {
          tmpXML = getAAfromCV(objectCV, attr, classCV, tagName);

          if (!tmpXML.trim().equals(""))
            retxml += tmpXML;

          continue;
        }

        method = classCV[0].getMethod(attr.getNamedItem("get").getNodeValue(), null);

        if (method.invoke(objectCV, null) != null)
        {
          value = method.invoke(objectCV, null).toString();
        } else
        {
          continue;
        }
View Full Code Here

                + " does not implement IXMLReaderFactory interface");
        }

        // use static method to create parser factory class instance
        try {
            Method meth = clas.getMethod("getInstance", null);
            return (IXMLReaderFactory)meth.invoke(null, null);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException("Specified parser factory class " + cname
                + " does not define static getInstance() method");
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Error on parser factory class " + cname + " getInstance() method call: "
View Full Code Here

            // occurance of fieldList from Template Body.
            Class printTemplateClass = printTemplate.getClass();
            for (int j = 0; j < fieldList.size(); j++) {
              String methodName = fieldList.elementAt(j).toString();
              String getmethod = "get" + methodName;
              Method method = printTemplateClass.getMethod(getmethod, null);
              Object methodValue = method.invoke(printTemplate, null);
              String valueString = "";
              if (valueString != null) {
                valueString = (String) methodValue;
              }
              if (valueString != null && valueString.equals("null")) {
View Full Code Here

        String set = "set";
        Method[] theMethods = clUI.getMethods();
        while (it.hasNext()) {
          String mName = (String) it.next();
          String getmethod = get + mName;
          Method mth = clDB.getMethod(getmethod, null);
          Object mthObj = mth.invoke(objDBVO, null);

          Object argList[] = new Object[1];
          argList[0] = mthObj;

          for (int i = 0; i < theMethods.length; i++) {
            String methodString = theMethods[i].getName();

            if (methodString.equals((set + mName))) {
              Method mth1 = clUI.getMethod((set + mName), theMethods[i].getParameterTypes());
              mth1.invoke(objUIVO, argList);
            }
          }

        }
      } // end of if statement (hm != null)
View Full Code Here

TOP

Related Classes of java.lang.reflect.Method

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.