Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * @(#)Class0.java		Created at 2013-10-31
   * 
   * Copyright (c) 2011-2013 azolla.org All rights reserved.
   * Azolla PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 
   */
  package org.azolla.l.ling.lang;
  
 
 
 
The coder is very lazy, nothing to write for this Class0 class

Author(s):
sk@azolla.org
Since:
ADK1.0
 
 public class Class0
 {
     private Class<?>            clazz    = null;
 
     private Object              instance = null;
 
     public Class0(String classNameObject... argsthrows Exception
     {
         this(classNamenullargs);
     }
 
     @SuppressWarnings("rawtypes")
     public Class0(String className, @Nullable Class<?>[] argTypesObject... argsthrows Exception
     {
         // clazz = ClassLoader.getSystemClassLoader().loadClass(className);
          = loadClass(className);
         if(argTypes == null)
         {
              = .getConstructor(Lists.transform(Lists.newArrayList(args), new Function<ObjectClass>()
             {
                 @Override
                 public Class apply(Object input)
                 {
                     return input.getClass();
                 }
             }).toArray(new Class[args.length])).newInstance(args);
         }
         else
         {
              = .getConstructor(argTypes).newInstance(args);
         }
     }
 
     public <T> T execMethod(Class<T> returnTypeString methodNameObject... argsthrows Exception
     {
         return execMethod(returnTypemethodNamenullargs);
     }
 
     @SuppressWarnings({"unchecked""rawtypes"})
     public <T> T execMethod(Class<T> returnTypeString methodName, @Nullable Class<?>[] argTypesObject... argsthrows Exception
     {
         Method m = null;
         if(argTypes == null)
         {
             m = .getMethod(methodName, Lists.transform(Lists.newArrayList(args), new Function<ObjectClass>()
             {
                 @Override
                 public Class apply(Object input)
                 {
                     return input.getClass();
                 }
             }).toArray(new Class[args.length]));
 
         }
         else
         {
             m = .getMethod(methodNameargTypes);
         }
         return (T) m.invoke(Modifier.isStatic(m.getModifiers()) ? null : args);
     }
 
     public Class<?> loadClass(String classNamethrows Exception
     {
         return Class.forName(className);
     }
 
     public static boolean exist(String className)
     {
         boolean rtnBoolean = true;
         try
         {
             Class.forName(className);
        }
        catch(ClassNotFoundException e)
        {
            Log0.warn(Class0.class.., KV.ins("className"className), e);
            rtnBoolean = false;
        }
        return rtnBoolean;
    }
New to GrepCode? Check out our FAQ X