Package java.lang

Examples of java.lang.Class$Atomic


            {
                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


                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

        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

  public Function getFunction() throws javax.xml.transform.TransformerException
  {

    try
    {
      Class function;

      // first get package name if necessary
      if (m_funcName.indexOf(".") < 0)
      {

        // String thisName = this.getClass().getName();
        // int lastdot = thisName.lastIndexOf(".");
        // String classname = thisName.substring(0,lastdot+1) + m_funcName;
        String classname = "org.apache.xpath.functions." + m_funcName;

        function = Class.forName(classname);
      }
      else
        function = Class.forName(m_funcName);

      Function func = (Function) function.newInstance();

      return func;
    }
    catch (ClassNotFoundException e)
    {
View Full Code Here

  public XObject execute(XPath path, XPathSupport execContext, Node context, int opPos, Vector args)
    throws org.xml.sax.SAXException
  {
    try
    {
      Class function;
      // first get package name if necessary
      if ( m_funcName.indexOf(".") < 0 )
      { 
        String thisName = this.getClass().getName();
        int lastdot = thisName.lastIndexOf(".");
        String classname = thisName.substring(0,lastdot+1) + m_funcName;     
        function = Class.forName(classname);
      }
      else
        function = Class.forName(m_funcName);
     
      Function func = (Function)function.newInstance();
      path.installFunction(m_funcName, m_funcID, func);
      return func.execute(path, execContext, context, opPos, args);
    }
    catch(ClassNotFoundException e)
    {
View Full Code Here

    * @param callee The target Ant object
    * @return The Project object that the given Ant object uses to execute the target call.
    */
   private static Project extractNewProject(Ant callee)
   {
      Class antClass = callee.getClass();
      Field newProjectField = null;
      Project newProject = null;

      try
      {
         newProjectField = antClass.getDeclaredField("newProject");
         newProjectField.setAccessible(true);
        
         newProject = (Project)newProjectField.get(callee);
      }
      catch (Exception e)
View Full Code Here

      {
         // Restore the original user and non-user properties to this Project object
         try
         {
            PropertyHelper helper = (PropertyHelper) targetProject.getReference(MagicNames.REFID_PROPERTY_HELPER);
            Class propertyHelperClass = helper.getClass();

            //check if Properties Maps are null
            if (m_properties != null)
            {
               Field propertiesField = propertyHelperClass.getDeclaredField("properties");

               propertiesField.setAccessible(true);
               propertiesField.set(helper, new Hashtable(m_properties));
            }

            if (m_userProperties != null)
            {
               Field userPropertiesField = propertyHelperClass.getDeclaredField("userProperties");

               userPropertiesField.setAccessible(true);
               userPropertiesField.set(helper, new Hashtable(m_userProperties));
            }
         }
View Full Code Here

            char first = Character.toUpperCase(methodName.charAt(0));
            String impl = "com.nirima.jenkins.webdav.impl.methods." + first + methodName.substring(1).toLowerCase();

            try {
                Class c = Class.forName(impl);
                IMethod method = (IMethod) c.newInstance();
                //method.init(request, response, null, repo, root);
                return method;
            } catch (Exception e) {
                throw new MethodException("Exception in creating method " + methodName, e);
            }
View Full Code Here

      if(!readeval)
        {
        throw Util.runtimeException("Record construction syntax can only be used when *read-eval* == true");
        }

    Class recordClass = RT.classForNameNonLoading(recordName.toString());

    char endch;
    boolean shortForm = true;
    int ch = read1(r);

    // flush whitespace
    while(isWhitespace(ch))
      ch = read1(r);

    // A defrecord ctor can take two forms. Check for map->R version first.
    if(ch == '{')
      {
      endch = '}';
      shortForm = false;
      }
    else if (ch == '[')
      endch = ']';
    else
      throw Util.runtimeException("Unreadable constructor form starting with \"#" + recordName + (char) ch + "\"");

    Object[] recordEntries = readDelimitedList(endch, r, true).toArray();
    Object ret = null;
    Constructor[] allctors = ((Class)recordClass).getConstructors();

    if(shortForm)
      {
      boolean ctorFound = false;
      for (Constructor ctor : allctors)
        if(ctor.getParameterTypes().length == recordEntries.length)
          ctorFound = true;

      if(!ctorFound)
        throw Util.runtimeException("Unexpected number of constructor arguments to " + recordClass.toString() + ": got " + recordEntries.length);

      ret = Reflector.invokeConstructor(recordClass, recordEntries);
      }
    else
      {
View Full Code Here

TOP

Related Classes of java.lang.Class$Atomic

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.