Examples of ObjectInstantiator


Examples of ext.jtester.objenesis.instantiator.ObjectInstantiator

   */
  public synchronized ObjectInstantiator getInstantiatorOf(Class clazz) {
    if (cache == null) {
      return strategy.newInstantiatorOf(clazz);
    }
    ObjectInstantiator instantiator = (ObjectInstantiator) cache.get(clazz.getName());
    if (instantiator == null) {
      instantiator = strategy.newInstantiatorOf(clazz);
      cache.put(clazz.getName(), instantiator);
    }
    return instantiator;
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.ObjectInstantiator

    private ObjectSpecification createSpecification(final Class<?> cls) {

        final AuthenticationSessionProvider authenticationSessionProvider = getRuntimeContext().getAuthenticationSessionProvider();
        final SpecificationLoader specificationLookup = getRuntimeContext().getSpecificationLoader();
        final ServicesProvider servicesProvider = getRuntimeContext().getServicesProvider();
        final ObjectInstantiator objectInstantiator = getRuntimeContext().getObjectInstantiator();

        // create contexts as inputs ...
        final SpecificationContext specContext = new SpecificationContext(getDeploymentCategory(), authenticationSessionProvider, servicesProvider, objectInstantiator, specificationLookup, facetProcessor);

        final AdapterManager adapterMap = getRuntimeContext().getAdapterManager();
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.ObjectInstantiator

    private ObjectSpecification createSpecification(final Class<?> cls) {

        final AuthenticationSessionProvider authenticationSessionProvider = getRuntimeContext().getAuthenticationSessionProvider();
        final SpecificationLookup specificationLookup = getRuntimeContext().getSpecificationLookup();
        final ServicesProvider servicesProvider = getRuntimeContext().getServicesProvider();
        final ObjectInstantiator objectInstantiator = getRuntimeContext().getObjectInstantiator();

        final SpecificationContext specContext = new SpecificationContext(authenticationSessionProvider, servicesProvider, objectInstantiator, specificationLookup);

        if (ObjectList.class.isAssignableFrom(cls)) {
            return new ObjectSpecificationForObjectList(specContext);
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.ObjectInstantiator

    private ObjectSpecification createSpecification(final Class<?> cls) {

        final AuthenticationSessionProvider authenticationSessionProvider = getRuntimeContext().getAuthenticationSessionProvider();
        final SpecificationLoader specificationLookup = getRuntimeContext().getSpecificationLoader();
        final ServicesProvider servicesProvider = getRuntimeContext().getServicesProvider();
        final ObjectInstantiator objectInstantiator = getRuntimeContext().getObjectInstantiator();

        // create contexts as inputs ...
        final SpecificationContext specContext = new SpecificationContext(getDeploymentCategory(), authenticationSessionProvider, servicesProvider, objectInstantiator, specificationLookup, facetProcessor);

        final AdapterManager adapterMap = getRuntimeContext().getAdapterManager();
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.ObjectInstantiator

        final AuthenticationSessionProvider authenticationSessionProvider =
            getRuntimeContext().getAuthenticationSessionProvider();
        final SpecificationLookup specificationLookup = getRuntimeContext().getSpecificationLookup();
        final ServicesProvider servicesProvider = getRuntimeContext().getServicesProvider();
        final ObjectInstantiator objectInstantiator = getRuntimeContext().getObjectInstantiator();

        final SpecificationContext specContext =
            new SpecificationContext(authenticationSessionProvider, servicesProvider, objectInstantiator,
                specificationLookup);
View Full Code Here

Examples of org.drools.objenesis.instantiator.ObjectInstantiator

     */
    public synchronized ObjectInstantiator getInstantiatorOf(final Class clazz) {
        if ( this.cache == null ) {
            return this.strategy.newInstantiatorOf( clazz );
        }
        ObjectInstantiator instantiator = (ObjectInstantiator) this.cache.get( clazz.getName() );
        if ( instantiator == null ) {
            instantiator = this.strategy.newInstantiatorOf( clazz );
            this.cache.put( clazz.getName(),
                       instantiator );
        }
View Full Code Here

Examples of org.objenesis.instantiator.ObjectInstantiator

      boolean isNonStaticMemberClass = enclosingType != null && type.isMemberClass()
        && !Modifier.isStatic(type.getModifiers());
      if (!isNonStaticMemberClass) {
        try {
          final ConstructorAccess access = ConstructorAccess.get(type);
          return new ObjectInstantiator() {
            public Object newInstance () {
              try {
                return access.newInstance();
              } catch (Exception ex) {
                throw new KryoException("Error constructing instance of class: " + className(type), ex);
              }
            }
          };
        } catch (Exception ignored) {
        }
      }
    }
    // Reflection.
    try {
      Constructor ctor;
      try {
        ctor = type.getConstructor((Class[])null);
      } catch (Exception ex) {
        ctor = type.getDeclaredConstructor((Class[])null);
        ctor.setAccessible(true);
      }
      final Constructor constructor = ctor;
      return new ObjectInstantiator() {
        public Object newInstance () {
          try {
            return constructor.newInstance();
          } catch (Exception ex) {
            throw new KryoException("Error constructing instance of class: " + className(type), ex);
View Full Code Here

Examples of org.objenesis.instantiator.ObjectInstantiator

  /** Creates a new instance of a class using {@link Registration#getInstantiator()}. If the registration's instantiator is null,
   * a new one is set using {@link #newInstantiator(Class)}. */
  public <T> T newInstance (Class<T> type) {
    Registration registration = getRegistration(type);
    ObjectInstantiator instantiator = registration.getInstantiator();
    if (instantiator == null) {
      instantiator = newInstantiator(type);
      registration.setInstantiator(instantiator);
    }
    return (T)instantiator.newInstance();
  }
View Full Code Here

Examples of org.objenesis.instantiator.ObjectInstantiator

  protected ObjectInstantiator newInstantiator (final Class type) {
    if (!Util.isAndroid) {
      // ReflectASM.
      try {
        final ConstructorAccess access = ConstructorAccess.get(type);
        return new ObjectInstantiator() {
          public Object newInstance () {
            try {
              return access.newInstance();
            } catch (Exception ex) {
              throw new KryoException("Error constructing instance of class: " + className(type), ex);
            }
          }
        };
      } catch (Exception ignored) {
      }
    }
    // Reflection.
    try {
      Constructor ctor;
      try {
        ctor = type.getConstructor((Class[])null);
      } catch (Exception ex) {
        ctor = type.getDeclaredConstructor((Class[])null);
        ctor.setAccessible(true);
      }
      final Constructor constructor = ctor;
      return new ObjectInstantiator() {
        public Object newInstance () {
          try {
            return constructor.newInstance();
          } catch (Exception ex) {
            throw new KryoException("Error constructing instance of class: " + className(type), ex);
View Full Code Here

Examples of org.objenesis.instantiator.ObjectInstantiator

  /** Creates a new instance of a class using {@link Registration#getInstantiator()}. If the registration's instantiator is null,
   * a new one is set using {@link #newInstantiator(Class)}. */
  public <T> T newInstance (Class<T> type) {
    Registration registration = getRegistration(type);
    ObjectInstantiator instantiator = registration.getInstantiator();
    if (instantiator == null) {
      instantiator = newInstantiator(type);
      registration.setInstantiator(instantiator);
    }
    return (T)instantiator.newInstance();
  }
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.