Package java.lang.reflect

Examples of java.lang.reflect.Field$FieldData


        assertNotNull(ClassUtils.getField(FakeDomainEntity.class, "id"));
    }

    @Test
    public void getGenericType() throws Exception {
        Field field = I18nText.class.getDeclaredField("values");
        assertEquals(ClassUtils.getGenericType(field), LocalizedValue.class);
    }
View Full Code Here


                makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class [] { String.class });
                putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] { int.class, aeDescClass });
                sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[] { });

                Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
                keyDirectObject = (Integer) keyDirectObjectField.get(null);
                Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
                kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
                Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
                kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
            } catch (ClassNotFoundException cnfe) {
                errorMessage = cnfe.getMessage();
                return false;
            } catch (NoSuchMethodException nsme) {
                errorMessage = nsme.getMessage();
                return false;
            } catch (NoSuchFieldException nsfe) {
                errorMessage = nsfe.getMessage();
                return false;
            } catch (IllegalAccessException iae) {
                errorMessage = iae.getMessage();
                return false;
            }
            break;
        case MRJ_2_1:
            try {
                mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
                mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
                Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
                kSystemFolderType = systemFolderField.get(null);
                findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] { mrjOSTypeClass });
                getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[] { File.class });
                getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] { File.class });
            } catch (ClassNotFoundException cnfe) {
                errorMessage = cnfe.getMessage();
View Full Code Here

            try
            {
                if (StringUtils.isNotEmpty(className))
                {
                    Field field = loader.loadClass(className).getField("TYPE");
                    primitiveClass = (Class)field.get(null);
                }
            }
            catch (final Exception exception)
            {
                throw new ClassUtilsException(exception);
View Full Code Here

            clazz);
        final Field[] fields = clazz.getFields();
        int fieldsNum = fields.length;

        final List values = new ArrayList();
        Field field;
        int modifiers;
        for (int ctr = 0; ctr < fieldsNum; ctr++)
        {
            field = fields[ctr];
            modifiers = field.getModifiers();
            if (Modifier.isStatic(modifiers))
            {
                if (type != null)
                {
                    if (type == field.getType())
                    {
                        values.add(fields[ctr].get(null));
                    }
                }
                else
View Full Code Here

                    makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class [] { String.class });
                    putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] { int.class, aeDescClass });
                    sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[] { });

                    Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
                    keyDirectObject = (Integer) keyDirectObjectField.get(null);
                    Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
                    kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
                    Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
                    kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
                } catch (ClassNotFoundException cnfe) {
                    errorMessage = cnfe.getMessage();
                    return false;
                } catch (NoSuchMethodException nsme) {
                    errorMessage = nsme.getMessage();
                    return false;
                } catch (NoSuchFieldException nsfe) {
                    errorMessage = nsfe.getMessage();
                    return false;
                } catch (IllegalAccessException iae) {
                    errorMessage = iae.getMessage();
                    return false;
                }
                break;
            case MRJ_2_1:
                try {
                    mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
                    mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
                    Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
                    kSystemFolderType = systemFolderField.get(null);
                    findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] { mrjOSTypeClass });
                    getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[] { File.class });
                    getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] { File.class });
                } catch (ClassNotFoundException cnfe) {
                    errorMessage = cnfe.getMessage();
View Full Code Here

   * Adds the given local path to the native library paths
   */ 
  public static void addNativePath(File localPath) {

      try {
        Field field;
            field = ClassLoader.class.getDeclaredField("usr_paths");
            field.setAccessible(true);
            String[] libs = (String[])field.get(null);
        // Only add the path if it does not exist yet
            for (int i=0; i<libs.length; ++i) if (localPath.equals(new File(libs[i]))) return;
            // OK, add the path
            String[] newlibs = new String[libs.length+1];
            for (int i=0; i<libs.length; ++i) newlibs[i] = libs[i];
            newlibs[libs.length] = localPath.getAbsolutePath();
            field.set(null, newlibs);
        } catch (SecurityException e) {
        } catch (NoSuchFieldException e) {
        } catch (IllegalArgumentException e) {
        } catch (IllegalAccessException e) {
        }
View Full Code Here

  }

  public static String getNativePath() {
        String ret = null;
      try {
        Field field;
            field = ClassLoader.class.getDeclaredField("usr_paths");
            field.setAccessible(true);
            String[] libs = (String[])field.get(null);
        for (int i=0; i<libs.length; ++i) {
          if (ret==null) ret = "";
          else ret += separator;
          ret += libs[i];
        }
View Full Code Here

          makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class [] { String.class });
          putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] { int.class, aeDescClass });
          sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[] { });

          Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
          keyDirectObject = (Integer) keyDirectObjectField.get(null);
          Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
          kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
          Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
          kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
        } catch (ClassNotFoundException cnfe) {
          errorMessage = cnfe.getMessage();
          return false;
        } catch (NoSuchMethodException nsme) {
          errorMessage = nsme.getMessage();
          return false;
        } catch (NoSuchFieldException nsfe) {
          errorMessage = nsfe.getMessage();
          return false;
        } catch (IllegalAccessException iae) {
          errorMessage = iae.getMessage();
          return false;
        }
        break;
      case MRJ_2_1:
        try {
          mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
          mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
          Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
          kSystemFolderType = systemFolderField.get(null);
          findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] { mrjOSTypeClass });
          getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[] { File.class });
          getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] { File.class });
        } catch (ClassNotFoundException cnfe) {
          errorMessage = cnfe.getMessage();
View Full Code Here

        addHandler();
    }
    @SuppressWarnings("unchecked")
    static void addHandler() {
        try {
            Field field = URL.class.getDeclaredField("handlers");
            field.setAccessible(true);
            Map handlers = (Map)field.get(null);
            handlers.put("pipe", new Handler());
        } catch (Exception e) {
            //ignore
        }
    }
View Full Code Here

            invokeSetter(setter, resource);
            return;
        }
       
        Field field = findFieldForResource(res);
        if (field != null) {
            Class<?> type = getResourceType(res, field);
            resource = resourceManager.resolveResource(res.name(), type);
            if (resource == null) {
                LOG.log(Level.INFO, "RESOURCE_RESOLVE_FAILED");
View Full Code Here

TOP

Related Classes of java.lang.reflect.Field$FieldData

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.