Examples of Class


Examples of java.lang.Class

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

Examples of java.lang.Class

    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

Examples of java.lang.Class

        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

Examples of org.apache.xml.utils.synthetic.Class

    // Proxy a class
    try
    {
      System.out.println("Proxying java.awt.Frame...");

      Class myC = Class.forName("java.awt.Frame");

      myC.toSource(System.out, 0);
      System.out.println(
        "\nProxying org.apache.xml.utils.synthetic.TestDriver...");

      myC =
        Class.forName("com.ibm.org.apache.xml.utils.synthetic.TestDriver");

      myC.toSource(System.out, 0);
    }
    catch (ClassNotFoundException e)
    {
      System.out.println("Couldn't proxy: ");
      e.printStackTrace();
    }

    // Start getting serious
    try
    {
      System.out.println("\nBuild a new beast...");

      Class myC = Class.declareClass(
        "com.ibm.org.apache.xml.utils.synthetic.BuildMe");
      Class inner = myC.declareInnerClass("island");

      inner.addExtends(Class.forName("java.lang.String"));

      Method m = inner.declareMethod("getValue");

      m.setReturnType(Class.forName("java.lang.String"));
      m.getBody().append("return toString();");
      myC.toSource(System.out, 0);
    }
View Full Code Here

Examples of org.eclipse.uml2.Class

     * @see org.andromda.metafacades.uml.FrontEndActivityGraph#getController()
     */
    protected java.lang.Object handleGetController()
    {
        // Take the frist class inside the FSM
        Class controller = null;
        for (Iterator it = ((StateMachine)this.metaObject).getOwnedMembers().iterator();
            it.hasNext() && controller == null;)
        {
            Object next = it.next();
            if (next instanceof Class)
View Full Code Here

Examples of org.eclipse.uml2.uml.Class

    // The edgeview represents the new graphical edge
    // with testing of its source and target nodes we can
    // know if the user reconnected the source or the target of the edge
    reconnectService.setReconnectingSource(edgeView.getSourceNode().equals(targetView));
    Class requirement = (Class)((DNodeList)edgeView.getTargetNode()).getTarget();

    reconnectService.setSubRequirement(requirement);
    reconnectService.setOldPointedClass(source);
    reconnectService.setNewPointedClass(target);
    return reconnectService.doSwitch(context);
View Full Code Here

Examples of org.eclipse.uml2.uml.Class

   * @param pkg
   *            The package
   * @return A block
   */
  public Class initBlockForPackage(org.eclipse.uml2.uml.Package pkg) {
    Class block = getBlock(pkg);
    return block;
  }
View Full Code Here

Examples of org.eclipse.uml2.uml.Class

   * @param parent
   *            Parent
   * @return Block
   */
  private Class getBlock(org.eclipse.uml2.uml.Package parent) {
    Class block = UMLFactory.eINSTANCE.createClass();
    parent.getPackagedElements().add(block);
    services.createAssociatedStereotype(block, "SysML::Blocks", "Block");
    String label = labels.computeSysmlLabel(block);
    block.setName(label);
    return block;
  }
View Full Code Here

Examples of org.eclipse.uml2.uml.Class

    Activity activity = action.getActivity();
    Operation contextOp = null;
    if (activity.getSpecification() instanceof Operation) {
      contextOp = (Operation) activity.getSpecification();
    } else if (activity.getOwner() instanceof Class) {
      Class oClass = (Class) activity.getOwner();
      contextOp = oClass.getOperation(activity.getName(), null, null);
    }
    return contextOp;
  }
View Full Code Here

Examples of org.eclipse.uml2.uml.Class

    Logging.debug(""+activity, guardedEdge);
    Operation contextOp = null;
    if (activity.getSpecification() instanceof Operation) {
      contextOp = (Operation) activity.getSpecification();
    } else if (activity.getOwner() instanceof Class) {
      Class oClass = (Class) activity.getOwner();
      contextOp = oClass.getOperation(activity.getName(), null, null);
    }
    return contextOp;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.