Package java.lang

Examples of java.lang.Class$MethodArray


public class JDBCArrayFactory extends JDBCFactory {

        protected Object processResult( ResultSet rs, String type, Parameter[] parameters )
                throws Throwable {

                Class clazz = Class.forName( type );
                DataBean db = null;
                ArrayList store = new ArrayList();

                for( int i = 0; rs.next(); i++ ) {
                        db = (DataBean)clazz.newInstance();
                        db.populateFrom( rs );
                        store.add( db );
                }

                return store;
View Full Code Here


                Integer length = (Integer)parameters[2].getValue();

                int total = 0;
                ArrayList store = new ArrayList();
                Slide slide = new Slide( length.intValue(), offset.intValue(), store );
                Class clazz = Class.forName( type );
                DataBean db = null;

                for( int i = 0; i < slide.getOffset() - 1; i++, total++ ) rs.next();
                for( int i = 0; rs.next() && ( i < slide.getSlideLength() ); i++, total++ ) {
                        db = (DataBean)clazz.newInstance();
                        db.populateFrom( rs );
                        store.add( i, db );
                }
                while( rs.next() ) total++;
View Full Code Here

*/
public class JDBCSingleFactory extends JDBCFactory {

        protected Object processResult( ResultSet rs, String type, Parameter[] parameters )
                throws Throwable {
                Class clazz = Class.forName( type );
                DataBean db = (DataBean)clazz.newInstance();
                if( rs.next() )
                        db.populateFrom( rs );
                return db;
        }
View Full Code Here

class Main
{
    private static Class load (RootClassLoader loader, String name)
    {
  Class retClass = null;
  try {
      retClass = loader.loadClass(name, true);
  } catch (ClassNotFoundException CNFE) {
      System.out.println("!! Something's wrong.  Couldn't find " +name+ ".class");
      CNFE.printStackTrace();
View Full Code Here

    public static void main (String[] args)
    {
  RootClassLoader rootCl = new RootClassLoader("root loader");

  Class firstClass = load(rootCl, "First");
  System.out.println("Main: loaded First.");
  Object firstInst = null;
  try {
    System.out.println("Main: first.newInstance(....");
    firstInst = firstClass.newInstance();
    System.out.println("Main: ...)");
  } catch (Exception X) {
      System.out.println("Probably should put First class def'n in `First.java`");
      X.printStackTrace();
  }

  System.out.println("Main: testing firstInst.");
  if (!(firstInst instanceof BaseClass)) {
      // Classloader for firstInst is RootClassLoader, while loader
      // for inline BaseClass reference if default loader.
      System.out.println("Notice that firstInst is *not* "+
             "an instance of BaseClass, because class loaders differ.");
  } else {
      // won't happen:
      ((First)firstInst).here();
  }
 
  Object firstInst2 = new First("other");
  ((First)firstInst2).here();
 
  // Kaffe's problem:
  Class secondClass = load(rootCl, "Second");
  System.out.println("loaded Second.");
  Object secondInst=null;
  try {
      secondInst = secondClass.newInstance();
  } catch (Exception X) {
      System.out.println("Probably should put Second class def'n in `Second.java`");
      X.printStackTrace();
  }
    }
View Full Code Here

        else if (t == Byte.class) return BYTE;
        else {
            // Might be a tuple or a bag, need to check the interfaces it
            // implements
            if (t instanceof Class) {
                Class c = (Class)t;
                Class[] ioeInterfaces = c.getInterfaces();
                Class[] interfaces = null;
                if(c.isInterface()){
                    interfaces = new Class[ioeInterfaces.length+1];
                    interfaces[0] = c;
                    for (int i = 1; i < interfaces.length; i++) {
                     interfaces[i] = ioeInterfaces[i-1];
                    }
View Full Code Here

        try {
            Field f = cls.getDeclaredField(fieldName);
            f.setAccessible(true);
            return f.get(obj);
        } catch (NoSuchFieldException e) {
            Class souper = cls.getSuperclass();
            if (souper != null) {
                return getInheritedFieldValue(obj, souper, fieldName);
            } else {
                /* getSuperclass() returns null if we've gotten all the
                   way up to Object. At this point we've checked every class
View Full Code Here

            {
                for( int i = 0; i < field.length; i++)
                {
                    if( ! Modifier.isStatic( field[i].getModifiers()))
                    {
                        Class fieldClass = field[i].getType();
                        if( fieldClass.isArray() || ! fieldClass.isPrimitive())
                            coeff[1]++;
                        else // Is simple primitive
                        {
                            String name = fieldClass.getName();

                            if( name.equals( "int") || name.equals( "I"))
                                coeff[0] += intSize;
                            else if( name.equals( "long") || name.equals( "J"))
                                coeff[0] += longSize;
View Full Code Here

      if(!readeval)
        {
        throw Util.runtimeException("Record construction syntax can only be used when *read-eval* == true");
        }

    Class recordClass = RT.classForNameNonLoading(recordName.toString());

    char endch;
    boolean shortForm = true;
    int ch = read1(r);

    // flush whitespace
    //while(isWhitespace(ch))
    //  ch = read1(r);

    // A defrecord ctor can take two forms. Check for map->R version first.
    if(ch == '{')
      {
      endch = '}';
      shortForm = false;
      }
    else if (ch == '(')
      endch = ')';
    else
      throw Util.runtimeException("Unreadable constructor form starting with \"#" + recordName + (char) ch + "\"");

    Object[] recordEntries = readDelimitedList(endch, r, true).toArray();
    Object ret = null;
    Constructor[] allctors = ((Class)recordClass).getConstructors();

    if(shortForm)
      {
      boolean ctorFound = false;
      for (Constructor ctor : allctors)
        if(ctor.getParameterTypes().length == recordEntries.length)
          ctorFound = true;

      if(!ctorFound)
        throw Util.runtimeException("Unexpected number of constructor arguments to " + recordClass.toString() + ": got " + recordEntries.length);

      ret = Reflector.invokeConstructor(recordClass, recordEntries);
      }
    else
      {
View Full Code Here

            {
                for( int i = 0; i < field.length; i++)
                {
                    if( ! Modifier.isStatic( field[i].getModifiers()))
                    {
                        Class fieldClass = field[i].getType();
                        if( fieldClass.isArray() || ! fieldClass.isPrimitive())
                            coeff[1]++;
                        else // Is simple primitive
                        {
                            String name = fieldClass.getName();

                            if( name.equals( "int") || name.equals( "I"))
                                coeff[0] += intSize;
                            else if( name.equals( "long") || name.equals( "J"))
                                coeff[0] += longSize;
View Full Code Here

TOP

Related Classes of java.lang.Class$MethodArray

Copyright © 2018 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.