alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (J_2.java)

This example Scala source code file (J_2.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

field, field, j_2, j_2, method, method, reflection, string, string

The Scala J_2.java source code

import java.lang.reflect.*;

public class J_2 {
  public void f1(Class<?> clazz) {
    Field[] fields = clazz.getDeclaredFields();
    for (int i = 0 ; i < fields.length; i++) {
      String name = fields[i].getName();
      if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { }
      else System.out.println("(" + name + "," + fields[i].getGenericType() + ")");
    }    
  }
  public void f2(Class<?> clazz) {
    Method[] methods = clazz.getDeclaredMethods();
    for (int i = 0 ; i < methods.length; i++) {
      String name = methods[i].getName();
      if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { }
      else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")");
    }    
  }

  public void javaRun() {
    f1(One.class);
    f2(One.class);
    f1(Two.class);
    f2(Two.class);
  }
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala J_2.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.