Examples of Constructor


Examples of com.artemis.utils.reflect.Constructor

  @SuppressWarnings("unchecked")
  <T extends Component> T newInstance(Class<T> componentClass, boolean constructorHasWorldParameter) {
    try {
      if (constructorHasWorldParameter) {
        Constructor constructor = ClassReflection.getConstructor(componentClass, World.class);
        return (T) constructor.newInstance(world);
      } else {
        return ClassReflection.newInstance(componentClass);
      }
    } catch (ReflectionException e) {
      throw new InvalidComponentException(componentClass, "Unable to instantiate component.", e);
View Full Code Here

Examples of com.badlogic.gdx.utils.reflect.Constructor

    try {
      return ClassReflection.newInstance(type);
    } catch (Exception ex) {
      try {
        // Try a private constructor.
        Constructor constructor = ClassReflection.getDeclaredConstructor(type);
        constructor.setAccessible(true);
        return constructor.newInstance();
      } catch (SecurityException ignored) {
      } catch (ReflectionException ignored) {
        if (type.isEnum()) {
          return type.getEnumConstants()[0];
        }
View Full Code Here

Examples of com.google.gwt.jsio.client.Constructor

    sw.print("var ");
    sw.print(subContext.objRef);
    sw.print(" = ");

    Constructor constructorAnnotation = hasTag(logger, constructor,
        Constructor.class);
    Global globalAnnotation = hasTag(logger, constructor, Global.class);
    if (constructorAnnotation != null) {
      // If the imported method is acting as an invocation of a JavaScript
      // constructor, use the new Foo() syntax, otherwise treat is an an
      // invocation on a field on the underlying JSO.
      sw.print("new ");
      sw.print(constructorAnnotation.value());

      // Write the invocation's parameter list
      sw.print("(");
      for (int i = 0; i < parameters.length; i++) {
        // Create a sub-context to generate the wrap/unwrap logic
View Full Code Here

Examples of com.google.gwt.search.jsio.client.Constructor

    sw.outdent();
    sw.println("}");

    // Determine the correct expression to use to initialize the object
    JClassType asClass = context.returnType.isClassOrInterface();
    Constructor constructorAnnotation = hasTag(logger, asClass,
        Constructor.class);
    Global globalAnnotation = hasTag(logger, asClass, Global.class);
    String constructor;
    if (globalAnnotation != null) {
      constructor = globalAnnotation.value();
    } else if (constructorAnnotation != null) {
      constructor = "new " + constructorAnnotation.value() + "()";
    } else {
      boolean hasImports = false;
      for (Task t : context.tasks) {
        hasImports |= t.imported != null;
View Full Code Here

Examples of com.google.gxp.compiler.base.Constructor

                           List<Import> imports,
                           List<ThrowsDeclaration> throwsDeclarations,
                           List<Parameter> parameters,
                           List<FormalTypeParameter> formalTypeParameters,
                           Expression content) {
    Constructor constructor = Constructor.empty(pos, "<gxp:template>");
    return new Template(pos, "<gxp:template>", fqTemplateName(dottedName),
                        schema, Collections.<JavaAnnotation>emptyList(), constructor, imports,
                        Collections.<ImplementsDeclaration>emptyList(),
                        throwsDeclarations,
                        parameters, formalTypeParameters,
View Full Code Here

Examples of com.gwtent.reflection.client.Constructor

public class JsonSerializer extends AbstractDataContractSerializer{
  protected Object deserializeObject(String json, ClassType type){
    JSONValue value = JSONParser.parse(json);
   
    Constructor constructor = type.findConstructor(new String[0]);
    Object result = constructor.newInstance();
   
    deserialize(value, result, type);
   
    return result;
  }
View Full Code Here

Examples of com.mysema.codegen.model.Constructor

    private void handleConstructors(EntityType entityType, List<? extends Element> elements) {
        for (ExecutableElement constructor : ElementFilter.constructorsIn(elements)) {
            if (configuration.isValidConstructor(constructor)) {
                List<Parameter> parameters = transformParams(constructor.getParameters());
                entityType.addConstructor(new Constructor(parameters));
            }
        }
    }
View Full Code Here

Examples of com.pogofish.jadt.ast.Constructor

                        Pkg._Pkg(list(_JavaEOLComment("//a pre-start comment"), _JavaEOLComment("//a start comment")), "hello.world"), list(Imprt._Imprt(list(IMPORTS_COMMENT), "wow.man"), Imprt._Imprt(NO_COMMENTS, "flim.flam")),
                        list(new DataType(list(_JavaEOLComment("//an annotation comment"), _JavaEOLComment("//datatype comment")), list(_Annotation("foo", Optional.<AnnotationElement>_None()), _Annotation("foo", _Some(_ElementValue(_AnnotationValueAnnotation(_Annotation("bar", Optional.<AnnotationElement>_None())))))),
                                "FooBar",
                                NO_FORMAL_TYPE_ARGUMENTS, NO_EXTENDS, NO_IMPLEMENTS,
                                list(
                                        new Constructor(list(_JavaEOLComment("//equal comment"), _JavaEOLComment("//constructor comment")), "foo", Util
                                                .<Arg> list()),
                                        new Constructor(list(_JavaEOLComment("//bar comment"), _JavaEOLComment("//really a bar comment")),
                                                "bar",
                                                list(new Arg(Util
                                                        .<ArgModifier> list(),
                                                        _Primitive(_IntType()),
                                                        "hey"),
                                                        new Arg(
                                                                list(_Final()),
                                                                _Ref(_ArrayType(_Ref(_ClassType(
                                                                        "String",
                                                                        NO_ACTUAL_TYPE_ARGUMENTS)))),
                                                                "yeah"))))),
                                new DataType(NO_COMMENTS, NO_ANNOTATIONS, "whatever", NO_FORMAL_TYPE_ARGUMENTS, NO_EXTENDS, NO_IMPLEMENTS,
                                        list(new Constructor(NO_COMMENTS, "whatever", Util
                                                .<Arg> list()))))), Util.<SyntaxError>list()).toString(), result.toString());
    }
View Full Code Here

Examples of fr.tm.elibel.smartqvt.qvt.qvtoperational.Constructor

      signature.append("|");
      signature.append(type.toString());
    }
    signature.append(")");
    signature.append(currentPackage.toString());
    Constructor result = (Constructor) getConstructorHM.get(signature
        .toString());
    if (result == null) {
      result = super.getConstructor(self, scopedIdentifier, t,
          cVariables, currentPackage, availablePackages, mainTrace);
      getConstructorHM.put(signature.toString(), result);
View Full Code Here

Examples of java.lang.reflect.Constructor

                return (T) Proxy.newProxyInstance(c.getClassLoader(), interfaces, ih);
            }
        }
        try {
            Class<?> pc = ProxyCodeGenerator.getClassProxy(c);
            Constructor cons = pc.getConstructor(new Class<?>[] { InvocationHandler.class });
            return (T) cons.newInstance(new Object[] { ih });
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
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.