Package java.lang

Examples of java.lang.Class$GetClassName


    //  return true;                            //BEFORE - BUGFIX - different class loaders (Tomcat)
    //else                                  //BEFORE - BUGFIX - different class loaders (Tomcat)
    //  return false;                            //BEFORE - BUGFIX - different class loaders (Tomcat)

    else {                                  //PLUS - BUGFIX - different class loaders (Tomcat)
      Class actualFormalParameterType = formalParameterType;        //PLUS - BUGFIX
      try {                                //PLUS - BUGFIX
        actualFormalParameterType = actualParameterType.getClassLoader().loadClass(formalParameterType.getName())//PLUS - BUGFIX
        if (actualFormalParameterType == null) actualFormalParameterType = formalParameterType;            //PLUS - BUGFIX
      } catch(Exception e) { }                                            //PLUS - BUGFIX
      boolean result = (actualFormalParameterType.isAssignableFrom(actualParameterType));                //PLUS - BUGFIX
      //System.err.println("SignaturePattern - isAssignable - Class  => " + formalParameterType + " is assignable from " + actualFormalParameterType + ":" + result);
      return result;                                                  //PLUS - BUGFIX
    }

  }
View Full Code Here



  private void initAdviceMethod(Class methodClass,String adviceName,Class hierarchyTop) {
    int      ambigousCnt = 0;
    Method   mObj = null;
    Class    crtClass = methodClass;

    // look up a method with the name 'adviceName'; if such a method is found,
    while (crtClass != null &&
        !crtClass.equals(hierarchyTop) &&          // (e.g., crtClass != MethodCut)
        hierarchyTop.isAssignableFrom(crtClass) && // (e.g., crtClass subclass of MethodCut)
        mObj == null) {

      Method[] methods = crtClass.getDeclaredMethods();
      ambigousCnt = 0;

      // we have to select some method
      // try to match a method with such a name

      for (int i=0; i < methods.length; i++)
        if ( methods[i].getName().equals(adviceName)) {
          mObj = methods[i];
          ambigousCnt++;
        }

      crtClass=crtClass.getSuperclass();
    }

    if (mObj == null)
      throw new MissingInformationException("No advice action specified");
    if (ambigousCnt > 1)
View Full Code Here

    */
   public boolean isInstanceOf(Object object, String instanceName)
   {
   try
     {
     Class type = getClass().forName(instanceName);
     return type.isInstance(object);
     }
    catch( ClassNotFoundException ex )
     {
     return false;
     }
View Full Code Here

  public Object createInstance( String conceptName )
     throws InstantiationException
  {
   try
     {
     Class type = getClass().forName(conceptName);
     Object res = type.newInstance();
     ownedObjects.add(res);
     return res;
     }
    catch( Exception ex )
     {
View Full Code Here

                try {
                    URL[] urls = new URL[1];
                    urls[0] = new URL(factoryJar);
                    ClassLoader loader = new URLClassLoader(urls,
                        BagFactory.class.getClassLoader());
                    Class c = Class.forName(factoryName, true, loader);
                    Object o = c.newInstance();
                    if (!(o instanceof BagFactory)) {
                        throw new RuntimeException("Provided factory " +
                            factoryName + " does not extend BagFactory!");
                    }
                    gSelf = (BagFactory)o;
View Full Code Here

                try {
                    URL[] urls = new URL[1];
                    urls[0] = new URL(factoryJar);
                    ClassLoader loader = new URLClassLoader(urls,
                        TupleFactory.class.getClassLoader());
                    Class c = Class.forName(factoryName, true, loader);
                    Object o = c.newInstance();
                    if (!(o instanceof TupleFactory)) {
                        throw new RuntimeException("Provided factory " +
                            factoryName + " does not extend TupleFactory!");
                    }
                    gSelf = (TupleFactory)o;
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

    protected void read(ObjectInput in) throws IOException, ClassNotFoundException {
        byte b = in.readByte();
        if (b != CLASS) throw new IOException("Expected 'CLASS' byte " + CLASS + ", got: " + b);

        Class clazz = (Class) in.readObject();

        Object object;
        try {
            object = allocateInstance.invoke(unsafe, clazz);
        } catch (Exception e) {
            throw (IOException) new IOException("Cannot construct " + clazz.getName()).initCause(e);
        }

        while (b != DONE) {
            b = in.readByte();
            switch (b) {
                case FIELD: {
                    String fieldName = in.readUTF();
                    Object value = in.readObject();
                    Field field = null;
                    try {
                        field = clazz.getDeclaredField(fieldName);
                    } catch (NoSuchFieldException e) {
                        throw (IOException) new IOException("Cannot find field " + fieldName).initCause(e);
                    }
                    setValue(field, object, value);
                }
View Full Code Here

        this.object = object;
    }

    protected void write(ObjectOutput out) throws IOException {
        List<Class> classes = new ArrayList<Class>();
        Class c = object.getClass();
        while (c != null && !c.equals(Object.class)) {
            classes.add(c);
            c = c.getSuperclass();
        }

        for (Class clazz : classes) {
            out.writeByte(CLASS);
            out.writeObject(clazz);
View Full Code Here

            offset = (Long) objectFieldOffset.invoke(unsafe, field);
        } catch (Exception e) {
            throw new IllegalStateException("Failed getting offset for: field=" + field.getName() + "  class=" + field.getDeclaringClass().getName(), e);
        }

        Class type = field.getType();
        try {
            if (type.isPrimitive()) {
                if (type.equals(Integer.TYPE)) {
                    putInt.invoke(unsafe, object, offset, ((Integer) value).intValue());
                } else if (type.equals(Long.TYPE)) {
                    putLong.invoke(unsafe, object, offset, ((Long) value).longValue());
                } else if (type.equals(Short.TYPE)) {
                    putShort.invoke(unsafe, object, offset, ((Short) value).shortValue());
                } else if (type.equals(Character.TYPE)) {
                    putChar.invoke(unsafe, object, offset, ((Character) value).charValue());
                } else if (type.equals(Byte.TYPE)) {
                    putByte.invoke(unsafe, object, offset, ((Byte) value).byteValue());
                } else if (type.equals(Float.TYPE)) {
                    putFloat.invoke(unsafe, object, offset, ((Float) value).floatValue());
                } else if (type.equals(Double.TYPE)) {
                    putDouble.invoke(unsafe, object, offset, ((Double) value).doubleValue());
                } else if (type.equals(Boolean.TYPE)) {
                    putBoolean.invoke(unsafe, object, offset, ((Boolean) value).booleanValue());
                } else {
                    throw new IllegalStateException("Unknown primitive type: " + type.getName());
                }
            } else {
                putObject.invoke(unsafe, object, offset, value);
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of java.lang.Class$GetClassName

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.