Package java.lang.reflect

Examples of java.lang.reflect.Field$FieldData


  protected void loadFromClass(final Class c)
  {
    final Field[] fields = c.getFields();
    for (int i = 0; i < fields.length; i++)
    {
      final Field f = fields[i];
      if (StyleKey.class.isAssignableFrom(f.getType()) == false)
      {
        // is no instance of stylekey...
        continue;
      }

      if (Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers()))
      {
        try
        {
          addKey((StyleKey) f.get(null));
        }
        catch (IllegalAccessException ex)
        {
          AbstractStyleKeyFactory.logger.warn("Unexpected Exception while loading stylekeys", ex);
        }
View Full Code Here


    int delta = -1;

    final Field[] fields = ExcelPrintSetupFactory.class.getDeclaredFields();
    for (int i = 0; i < fields.length; i++)
    {
      final Field field = fields[i];
      if (ExcelPageDefinition.class.isAssignableFrom(field.getType()) == false)
      {
        // Log.debug ("Is no valid pageformat definition");
        continue;
      }
      if (Modifier.isStatic(field.getModifiers()) == false)
      {
        // is no static field, who defined it here?
        continue;
      }
      try
      {
        final ExcelPageDefinition pageformat = (ExcelPageDefinition) field.get(null);
        if ((pageformat.getWidth() < width) || (pageformat.getHeight() < height))
        {
          // paper is too small, ignore it
          continue;
        }
View Full Code Here

    {
      return -1;
    }
    try
    {
      final Field field = ExcelPrintSetupFactory.class.getDeclaredField(paper);
      if (ExcelPageDefinition.class.isAssignableFrom(field.getType()) == false)
      {
        // Log.debug ("Is no valid pageformat definition");
        return -1;
      }
      final Object o = field.get(null);
      final ExcelPageDefinition pageformat = (ExcelPageDefinition) o;
      return pageformat.getPageFormatCode();
    }
    catch (NoSuchFieldException nfe)
    {
View Full Code Here

        if (validator != null)
        {
            String field = fieldName.substring(fieldName.lastIndexOf(".") + 1);
            String capitalizedField = StringUtils.capitalize(field);
            Object formBackingObject = clazz.newInstance();
            Field f = clazz.getDeclaredField(field);
            Object value = this.getValueObject(f.getType(), fieldValue);
            f.setAccessible(true);
            f.set(formBackingObject, value);
            Errors errors = validateObject(formBackingObject);
            FieldError error = errors.getFieldError(field);
            if (error != null) message = error.getCode();
        }
        return message;
View Full Code Here

     
      ClassLoader cl = new URLClassLoader(new URL[]{jar_file.toURI().toURL()}, parent);
     
        Class c = cl.loadClass( "org.gudy.azureus2.core3.util.Constants");

        Field  field = c.getField( "AZUREUS_VERSION" );
       
        return((String)field.get( null ));
       
    }catch( Throwable e){
           
      return( null );
    }
View Full Code Here

    try
    {
      final Field[] fields = c.getFields();
      for (int i = 0; i < fields.length; i++)
      {
        final Field field = fields[i];
        final int modifiers = field.getModifiers();
        if (Modifier.isPublic(modifiers) &&
            Modifier.isStatic(modifiers))
        {
          if (Modifier.isFinal(modifiers) == false)
          {
            logger.warn("Invalid implementation: StyleKeys should be 'public static final': " + c);
          }
          if (field.getType().isAssignableFrom(StyleKey.class))
          {
            //noinspection UnusedDeclaration
            final StyleKey value = (StyleKey) field.get(null);
            // ignore the returned value, all we want is to trigger the key
            // creation
            // Log.debug ("Loaded key " + value);
          }
        }
View Full Code Here

      int TVM_SETEXTENDEDSTYLE = ((Number) claOS.getField(
          "TVM_SETEXTENDEDSTYLE").get(null)).intValue();
      int TVS_EX_FADEINOUTEXPANDOS = ((Number) claOS.getField(
          "TVS_EX_FADEINOUTEXPANDOS").get(null)).intValue();

      Field fldHandle = this.getClass().getField("handle");
      Class<?> handleType = fldHandle.getType();
      if (handleType == int.class) {
        Method methSendMessage = claOS.getMethod("SendMessage", int.class,
            int.class, int.class, int.class);
        Number nbits2 = (Number) methSendMessage.invoke(null,
            fldHandle.get(this), TVM_GETEXTENDEDSTYLE, 0, 0);
        int bits2 = nbits2.intValue() & (~TVS_EX_FADEINOUTEXPANDOS);

        methSendMessage.invoke(null, ((Number) fldHandle.get(this)).intValue(),
            TVM_SETEXTENDEDSTYLE, 0, bits2);
      } else {
        Method methSendMessage = claOS.getMethod("SendMessage", long.class,
            int.class, long.class, long.class);

        Number nbits2 = (Number) methSendMessage.invoke(null,
            fldHandle.get(this), TVM_GETEXTENDEDSTYLE, 0, 0);
        long bits2 = nbits2.longValue() & (~TVS_EX_FADEINOUTEXPANDOS);

        methSendMessage.invoke(null,
            ((Number) fldHandle.get(this)).longValue(), TVM_SETEXTENDEDSTYLE,
            0, bits2);
      }

    } catch (Throwable t) {
      t.printStackTrace();
View Full Code Here

     */
    public static Color getNamedColor(String name, Color defaultColor) {
        if (name != null) {
            Field[] colorFields = Color.class.getDeclaredFields();
            for (int i = 0; i < colorFields.length; i++) {
                Field f = colorFields[i];
                try {
                    if (name.equalsIgnoreCase(f.getName())) {
                        return (Color) f.get((Object) null);
                    }
                } catch (IllegalAccessException iae) {
                    // Whoa, shouldn't happen, but hey
                } catch (ClassCastException cce) {
                    // Shouldn't ask for anything other than colors,
View Full Code Here

*
*/
@SuppressWarnings("unchecked")
public class FullTextSearcherProvider implements Provider<FullTextSearcher> {
  public FullTextSearcher get() {
      Field field = InjectorContext.currentField();
      Class<?> clazz = String.class;
      Type genericType = field.getGenericType();
      if(genericType instanceof ParameterizedTypeImpl){
        ParameterizedTypeImpl pgType = (ParameterizedTypeImpl)genericType;
        Type[] actualTypeArguments = pgType.getActualTypeArguments();
        clazz = (Class<?>)actualTypeArguments[1];
      }
View Full Code Here

*
*/
@SuppressWarnings("unchecked")
public class BaseEntityManagerProvider implements Provider<BaseEntityManager> {
    public BaseEntityManager get() {
      Field field = InjectorContext.currentField();
      Class<?> clazz = String.class;
      Type genericType = field.getGenericType();
      if(genericType instanceof ParameterizedTypeImpl){
        ParameterizedTypeImpl pgType = (ParameterizedTypeImpl)genericType;
        Type[] actualTypeArguments = pgType.getActualTypeArguments();
        clazz = (Class<?>)actualTypeArguments[1];
      }
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.