private MetaConstructor getAccessibleNoArgConstructor(final MetaClass type) { final MetaConstructor noArgConstr = type.getDeclaredConstructor(new MetaClass[0]); if (noArgConstr != null && (noArgConstr.isPublic() || noArgConstr.isProtected())) { return noArgConstr; } else { return null; } }
@Override public boolean isDefaultInstantiable() { if (isInterface() || isAbstract()) { return false; } final MetaConstructor c = getConstructor(new MetaClass[0]); return c != null && c.isPublic(); }
@Override public boolean isDefaultInstantiable() { if (isInterface() || isAbstract()) { return false; } final MetaConstructor c = getConstructor(new MetaClass[0]); return c != null && c.isPublic(); }
if (injectableConstructors.size() == 1) { final MetaConstructor injectConstructor = injectableConstructors.get(0); final boolean instantiable = injectConstructor.isPublic() || !isJavaScriptObject(type); if (!instantiable) { problems.add(String.format("Cannot access constructor for %s.", type.getFullyQualifiedName())); } else if (noArgConstructor == null || !(noArgConstructor.isPublic() || noArgConstructor.isProtected())) { log.debug("The class {} must be proxiable but does not have an accessible no-argument constructor", type.getFullyQualifiedName()); final boolean injectConstructorProxiable = injectConstructor.isPublic() || injectConstructor.isProtected(); if (!injectConstructorProxiable) { problems.add(String.format( final boolean instantiable = noArgConstructor != null && (noArgConstructor.isPublic() || !isJavaScriptObject(type)); final boolean proxiable = noArgConstructor != null && (noArgConstructor.isPublic() || noArgConstructor.isProtected()); final boolean passesProxiability = scopeDoesNotRequireProxy(type) || proxiable;
return noArgConstructor != null && (noArgConstructor.isPublic() || !isJavaScriptObject(type));
private void processInjectionPoints(final Injectable typeInjectable, final DependencyGraphBuilder builder, final List<String> problems) { final MetaClass type = typeInjectable.getInjectedType(); final MetaConstructor injectableConstructor = getInjectableConstructor(type); if (injectableConstructor != null) { if (!injectableConstructor.isPublic()) { problems.add("The constructor of " + typeInjectable.getInjectedType().getFullyQualifiedName() + " annotated with @Inject must be public."); } addConstructorInjectionPoints(typeInjectable, injectableConstructor, builder); } addFieldInjectionPoints(typeInjectable, builder, problems); addMethodInjectionPoints(typeInjectable, builder, problems); }
private void assignNewObjectWithZeroArgConstructor(final Injectable injectable, final List<Statement> createInstanceStatements) { final MetaConstructor noArgConstr = injectable.getInjectedType().getDeclaredConstructor(new MetaClass[0]); final Object newObjectStmt; if (noArgConstr.isPublic()) { newObjectStmt = newObject(injectable.getInjectedType()); } else { newObjectStmt = controller.exposedConstructorStmt(noArgConstr); } createInstanceStatements.add(declareFinalVariable("instance", injectable.getInjectedType(), newObjectStmt)); }
private MetaConstructor getAccessibleConstructor(final Injectable injectable) { final MetaClass type = injectable.getInjectedType(); final MetaConstructor noArgConstr = getAccessibleNoArgConstructor(type); if (noArgConstr != null) { return noArgConstr; } for (final Dependency dep : injectable.getDependencies()) { if (dep.getDependencyType().equals(DependencyType.Constructor)) { final MetaConstructor injectableConstr = (MetaConstructor) ((ParamDependency) dep).getParameter().getDeclaringMember(); return (injectableConstr.isPublic() || injectableConstr.isProtected()) ? injectableConstr : null; } } return null; }
if (defaultConstructor == null || !defaultConstructor.isPublic()) { throw new InvalidMappingException("there is no custom mapping or default no-arg constructor to map: " + toMap.getFullyQualifiedName());
if (defaultConstructor == null || !defaultConstructor.isPublic()) { throw new InvalidMappingException("there is no custom mapping or default no-arg constructor to map: " + toMap.getFullyQualifiedName());
if (bindable.getDeclaredConstructor(new MetaClass[0]) == null || !bindable.getDeclaredConstructor(new MetaClass[0]).isPublic()) { throw new RuntimeException("@Bindable type needs a public default no-arg constructor: " + bindable.getFullyQualifiedName());
if (bindable.getDeclaredConstructor(new MetaClass[0]) == null || !bindable.getDeclaredConstructor(new MetaClass[0]).isPublic()) { throw new RuntimeException("@Bindable type needs a public default no-arg constructor: " + bindable.getFullyQualifiedName());
final MetaConstructor constructor = mapping.getMember(); if (constructor.isPublic()) { builder .append(Stmt.declareVariable(toMap).named("entity")
final MetaConstructor constructor = mapping.getMember(); if (constructor.isPublic()) { builder .append(Stmt.declareVariable(toMap).named("entity")