Codota Logo
InjectableFactory.getInstance
Code IndexAdd Codota to your IDE (free)

How to use
getInstance
method
in
org.apache.wink.common.internal.registry.InjectableFactory

Best Java code snippets using org.apache.wink.common.internal.registry.InjectableFactory.getInstance (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.apache.wink/wink-common

private void createFormalParameters() {
  formalParameters = new LinkedList<Injectable>();
  Annotation[][] parameterAnnotations = method.getParameterAnnotations();
  Type[] paramTypes = method.getGenericParameterTypes();
  for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
    Injectable fp =
      InjectableFactory.getInstance().create(paramTypes[pos],
                          parameterAnnotations[pos],
                          method,
                          false,
                          null);
    formalParameters.add(fp);
  }
}
origin: org.apache.wink/wink-common

@Override
protected Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
  Context context = field.getAnnotation(Context.class);
  if (context != null) {
    return InjectableFactory.getInstance().createContextParam(GenericsUtils
                                   .getClassType(fieldType, ((Member) field).getDeclaringClass()),
                                 field.getAnnotations(),
                                 (Member)field);
  }
  return null;
}
origin: org.apache.wink/wink-common

@Override
protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
  logger.trace("parseAccessibleObject({}, {})", field, fieldType);
  Injectable injectable =
    InjectableFactory.getInstance().create(fieldType,
                        field.getAnnotations(),
                        (Member)field,
                        getMetadata().isEncoded(),
                        null);
  logger.trace("Injectable is {}", injectable);
  if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
    // EntityParam should be ignored for fields (see JSR-311 3.2)
    logger.trace("parseAccessibleObject() returning null");
    return null;
  }
  logger.trace("parseAccessibleObject() returning {}", injectable);
  return injectable;
}
origin: org.apache.wink/wink-server

public void handleRequest(MessageContext context, HandlersChain chain) throws Throwable {
  SearchResult result = context.getAttribute(SearchResult.class);
  // create and save the invocation parameters for the found method
  List<Injectable> formal = result.getMethod().getMetadata().getFormalParameters();
  logger.trace("Formal Injectable parameters list is: {}", formal); //$NON-NLS-1$
  Object[] parameters = InjectableFactory.getInstance().instantiate(formal, context);
  if(logger.isTraceEnabled()) {
    if(parameters == null) {
      logger.trace("Actual parameters list to inject is: null"); //$NON-NLS-1$
    } else {
      logger.trace("Actual parameters list to inject is: {}", parameters); //$NON-NLS-1$
    }
  }
  result.setInvocationParameters(parameters);
  chain.doChain(context);
}
origin: org.apache.wink/wink-common

  InjectableFactory.getInstance().instantiate(method.getFormalParameters(), context);
try {
origin: org.apache.wink/wink-common

private void parseMethodParameters(Method method, MethodMetadata methodMetadata) {
  logger.trace("parseMethodParameters({}, {}), entry", method, methodMetadata);
  Annotation[][] parameterAnnotations = method.getParameterAnnotations();
  Type[] paramTypes = getParamTypesFilterByXmlElementAnnotation(method);
  boolean entityParamExists = false;
  for (int pos = 0, limit = paramTypes.length; pos < limit; pos++) {
    Injectable fp =
      InjectableFactory.getInstance().create(paramTypes[pos],
                          parameterAnnotations[pos],
                          method,
                          getMetadata().isEncoded() || methodMetadata
                            .isEncoded(),
                          methodMetadata.getDefaultValue());
    if (fp.getParamType() == Injectable.ParamType.ENTITY) {
      if (entityParamExists) {
        // we are allowed to have only one entity parameter
        String methodName =
          method.getDeclaringClass().getName() + "." + method.getName(); //$NON-NLS-1$
        throw new IllegalStateException(Messages
          .getMessage("resourceMethodMoreThanOneEntityParam", methodName)); //$NON-NLS-1$
      }
      entityParamExists = true;
    }
    methodMetadata.getFormalParameters().add(fp);
    logger.trace("Adding formal parameter {}", fp);
  }
  logger.trace("parseMethodParameters(), exit");
}
origin: org.apache.wink/wink-common

private void mergeFormalParameterMetadata(MethodMetadata metadata, Method method) {
  logger.trace("mergeFormalParameterMetadata({})", new Object[] {metadata, method});
  Type[] parameterTypes = method.getGenericParameterTypes();
  List<Injectable> currentParameters =
    new ArrayList<Injectable>(metadata.getFormalParameters());
  metadata.getFormalParameters().clear();
  int i = 0;
  for (Injectable injectable : currentParameters) {
    Injectable fp =
      InjectableFactory.getInstance().create(parameterTypes[i],
                          injectable.getAnnotations(),
                          method,
                          getMetadata().isEncoded() || metadata
                            .isEncoded(),
                          metadata.getDefaultValue());
    metadata.getFormalParameters().add(fp);
    ++i;
  }
  logger.trace("mergeFormalParameterMetadata exit");
}
origin: org.apache.wink/wink-common

  InjectableFactory.getInstance().instantiate(method.getFormalParameters(), context);
try {
origin: org.apache.wink/wink-common

InjectableFactory.getInstance()
  .create(paramTypes[pos],
      parameterAnnotations[pos],
origin: org.apache.wink/wink-common

@Override
protected final Injectable parseAccessibleObject(AccessibleObject field, Type fieldType) {
  Injectable injectable =
    InjectableFactory.getInstance().create(fieldType,
                        field.getAnnotations(),
                        (Member)field,
                        getMetadata().isEncoded(),
                        null);
  if (injectable.getParamType() == Injectable.ParamType.ENTITY) {
    // EntityParam should be ignored for fields (see JSR-311 3.2)
    return null;
  }
  return injectable;
}
origin: org.apache.wink/wink-common

/**
 * creates object (StaticResource or Provider) based on its ClassMetadata
 * 
 * @param metadata
 * @param runtimeContext
 * @return created object
 */
static Object createObject(ClassMetadata metadata, RuntimeContext runtimeContext) {
  try {
    // use constructor to create a prototype
    ConstructorMetadata constructorMetadata = metadata.getConstructor();
    Constructor<?> constructor = constructorMetadata.getConstructor();
    List<Injectable> formalParameters = constructorMetadata.getFormalParameters();
    Object[] params =
      InjectableFactory.getInstance().instantiate(formalParameters, runtimeContext);
    Object object = constructor.newInstance(params);
    injectFields(object, metadata, runtimeContext);
    return object;
  } catch (RuntimeException e) {
    throw e;
  } catch (InvocationTargetException e) {
    Throwable targetException = e.getTargetException();
    if (targetException instanceof RuntimeException) {
      throw (RuntimeException)targetException;
    }
    throw new ObjectCreationException(targetException);
  } catch (Exception e) {
    throw new ObjectCreationException(e);
  }
}
org.apache.wink.common.internal.registryInjectableFactorygetInstance

Popular methods of InjectableFactory

  • setInstance
  • instantiate
    Instantiates a list of formal parameters into an Object array
  • create
  • createContextParam
  • createCookieParam
  • createEntityParam
  • createFormParam
  • createHeaderParam
  • createMatrixParam
  • createPathParam
  • createQueryParam
  • createQueryParam

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JCheckBox (javax.swing)
  • JPanel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now