/*
(non-Javadoc)

@see javax.servlet.ServletResponseWrapper#isWrapperFor(java.lang.Class)
439196
@Override
    public boolean isWrapperFor(@SuppressWarnings("rawtypes") Class wrappedType) {
        if (!ServletResponse.class.isAssignableFrom(wrappedType)) {
            throw new IllegalArgumentException("Given class " +
                                               wrappedType.getName() + " not a subinterface of " +
                                               ServletResponse.class.getName());
        }

        final ServletResponse response = getHttpServletResponse();
        @SuppressWarnings("unchecked")
        final Class<? extends ServletResponse> wrappedServletType = wrappedType;

        if (wrappedServletType.isAssignableFrom(response.getClass())) {
            return true;
        } else if (response instanceof ServletResponseWrapper) {
            return ((ServletResponseWrapper) response).isWrapperFor(wrappedType);
        } else {
            return false;
        }
    }
697625
@Override
    public boolean isAttached(Appender appender) {
        if (appenderList == null || appender == null)
            return false;
        Appender a;
        Iterator<Appender> it = appenderList.iterator();
        while (it.hasNext()) {
            a = (Appender) it.next();
            if (a == appender) {
                return true;
            }
        }
        return false;
    }
1073508
function JQueryWrapper() {
// public
    /**
     * The wrapper is an object, so it can't act like a function. We supply
     * an explicit init() method to be used where jQuery() previously applied.
     */
    this.init = function(selector, context) {
        return new this.jQuery.fn.init(selector, context);
    };

    this.clean = function(elems, context, fragment) {
        return this.jQuery.clean(elems, context, fragment);
    };
}
19372
private void registerServant(BusinessRemoteWrapper wrapper, int i)
    {
        // synchronized on the remote Wrapper to set the isRemoteRegistered flag
        synchronized (wrapper)
        {
            if (!ivBusinessRemoteRegistered[i])
            {
                try
                {
                    if (!isZOS)
                    {
                        // Since there may be multiple remote interfaces per bean
                        // type, a unique WrapperId must be formed by combining the
                        // BeanId with specific remote interface information. d419704
                        WrapperId wrapperId = new WrapperId
                                        (wrapper.beanId.getByteArrayBytes(),
                                                        wrapper.bmd.ivBusinessRemoteInterfaceClasses[i].getName(),
                                                        i);

                        // Servant registration must be performed with the application classloader
                        // in force.  This is especially needed for JITDeploy since
                        // the JIT pluggin will be on the application classloader.
                        // Without the JIT pluggin the classloader will not trigger
                        // JITDeploy to create the stub.  //d521388
                        Object originalLoader = ThreadContextAccessor.UNCHANGED;
                        try
                        {
                            if (ivBMD != null) // EJBFactories have no BMD.   d529446
                            {
                                originalLoader = EJBThreadData.svThreadContextAccessor.pushContextClassLoaderForUnprivileged(ivBMD.classLoader); //PK83186

                                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                {
                                    if (originalLoader != ThreadContextAccessor.UNCHANGED)
                                    {
                                        Tr.debug(tc, "registerServant : old ClassLoader = " + originalLoader);
                                        Tr.debug(tc, "registerServant : new ClassLoader = " + ivBMD.classLoader);
                                    }
                                    else
                                    {
                                        Tr.debug(tc, "registerServant : current ClassLoader = " + ivBMD.classLoader);
                                    }
                                }
                            }
                            wrapper.container.getEJBRuntime().registerServant(wrapperId, wrapper);
                        } finally
                        {
                            EJBThreadData.svThreadContextAccessor.popContextClassLoaderForUnprivileged(originalLoader);
                        } // finally

                    } // if( !isZOS )

                    ivBusinessRemoteRegistered[i] = true;
                } catch (Throwable ex)
                {
                    FFDCFilter.processException(ex, CLASS_NAME + ".registerServant", "439", this);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    {
                        Tr.event(tc, "Failed to register wrapper instance", new Object[] { wrapper, ex });
                    }
                }

            } // if ( ! ivBusinessRemoteRegistered[i] )

        } //synchronized( wrapper )

    }
535498
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
    public void formatWrapper(final StringBuilder sb, final ThrowableProxy cause, final List<String> ignorePackages, final String suffix) {
        this.formatWrapper(sb, cause, ignorePackages, PlainTextRenderer.getInstance(), suffix);
    }
931691
public static boolean isVetoed(Class<?> javaClass) {
        if (javaClass.isAnnotationPresent(Vetoed.class)) {
            return true;
        }
        return isPackageVetoed(javaClass.getPackage());
    }
213949
public static ServletHttpResponse unwrap(ServletResponse response)
    {
        while (!(response instanceof ServletHttpResponse))
        {
            if (response instanceof ServletResponseWrapper)
            {
                ServletResponseWrapper wrapper =
                    (ServletResponseWrapper)response;
                response=wrapper.getResponse();
            }
            else
                throw new IllegalArgumentException("Does not wrap ServletHttpResponse");
        }

        return (ServletHttpResponse)response;
    }
1088413
private MyWrapper asMyWrapper(StringWrapper w)
    {
	if (w instanceof MyWrapper) return (MyWrapper)w;
	else return new MyWrapper(w.unwrap());
    }
337228
public IServletWrapper createServletWrapper(IServletConfig config) throws Exception
  {
    ServletWrapper wrapper = new com.ibm.ws.webcontainer.osgi.servlet.ServletWrapper(extensionContext);

    if (config == null)
      return wrapper;
    try
    {
      wrapper.initialize(config);
    }
    catch (Throwable e)
    {
      // Might be more serious....so first log
      e.printStackTrace(System.out);
    }

    return wrapper;
  }
1004934
public static boolean isTypeWrappedPrimitive(TypeName value) {
		return isTypeIncludedIn(value, Byte.class, Character.class, Boolean.class, Short.class, Integer.class,
				Long.class, Float.class, Double.class);
	}
195435
@Override
    public final EJSWrapperCommon getWrapper(BeanId id) // f111627
    throws CSIException,
                    RemoteException
    {
        homeEnabled();
        return wrapperManager.getWrapper(id); // d156807.1
    }
479970
public DrawerBuilder withAdapterWrapper(@NonNull RecyclerView.Adapter adapterWrapper) {
        if (mAdapter == null) {
            throw new RuntimeException("this adapter has to be set in conjunction to a normal adapter which is used inside this wrapper adapter");
        }
        this.mAdapterWrapper = adapterWrapper;
        return this;
    }
299904
public static boolean isPrimitiveWrapper(Class pType) {
        return pType == Boolean.class || pType == Byte.class
                || pType == Character.class || pType == Double.class
                || pType == Float.class || pType == Integer.class
                || pType == Long.class || pType == Short.class;
    }
873418
@Nullable
  public static Class <?> getPrimitiveWrapperClass (@Nullable final Class <?> aClass)
  {
    if (isPrimitiveWrapperType (aClass))
      return aClass;
    return PRIMITIVE_TO_WRAPPER.get (aClass);
  }
137741
@SuppressWarnings("null")
    private static Wrapper findWrapper(Class<?> clazz, List<Wrapper> wrappers,
            String name, Class<?>[] paramTypes, Object[] paramValues) {

        Map<Wrapper,MatchResult> candidates = new HashMap<>();

        int paramCount;
        if (paramTypes == null) {
            paramCount = 0;
        } else {
            paramCount = paramTypes.length;
        }

        for (Wrapper w : wrappers) {
            Class<?>[] mParamTypes = w.getParameterTypes();
            int mParamCount;
            if (mParamTypes == null) {
                mParamCount = 0;
            } else {
                mParamCount = mParamTypes.length;
            }

            // Check the number of parameters
            if (!(paramCount == mParamCount ||
                    (w.isVarArgs() && paramCount >= mParamCount))) {
                // Method has wrong number of parameters
                continue;
            }

            // Check the parameters match
            int exactMatch = 0;
            int assignableMatch = 0;
            int coercibleMatch = 0;
            boolean noMatch = false;
            for (int i = 0; i < mParamCount; i++) {
                // Can't be null
                if (mParamTypes[i].equals(paramTypes[i])) {
                    exactMatch++;
                } else if (i == (mParamCount - 1) && w.isVarArgs()) {
                    Class<?> varType = mParamTypes[i].getComponentType();
                    for (int j = i; j < paramCount; j++) {
                        if (isAssignableFrom(paramTypes[j], varType)) {
                            assignableMatch++;
                        } else {
                            if (paramValues == null) {
                                noMatch = true;
                                break;
                            } else {
                                if (isCoercibleFrom(paramValues[j], varType)) {
                                    coercibleMatch++;
                                } else {
                                    noMatch = true;
                                    break;
                                }
                            }
                        }
                        // Don't treat a varArgs match as an exact match, it can
                        // lead to a varArgs method matching when the result
                        // should be ambiguous
                    }
                } else if (isAssignableFrom(paramTypes[i], mParamTypes[i])) {
                    assignableMatch++;
                } else {
                    if (paramValues == null) {
                        noMatch = true;
                        break;
                    } else {
                        if (isCoercibleFrom(paramValues[i], mParamTypes[i])) {
                            coercibleMatch++;
                        } else {
                            noMatch = true;
                            break;
                        }
                    }
                }
            }
            if (noMatch) {
                continue;
            }

            // If a method is found where every parameter matches exactly,
            // return it
            if (exactMatch == paramCount) {
                return w;
            }

            candidates.put(w, new MatchResult(
                    exactMatch, assignableMatch, coercibleMatch, w.isBridge()));
        }

        // Look for the method that has the highest number of parameters where
        // the type matches exactly
        MatchResult bestMatch = new MatchResult(0, 0, 0, false);
        Wrapper match = null;
        boolean multiple = false;
        for (Map.Entry<Wrapper, MatchResult> entry : candidates.entrySet()) {
            int cmp = entry.getValue().compareTo(bestMatch);
            if (cmp > 0 || match == null) {
                bestMatch = entry.getValue();
                match = entry.getKey();
                multiple = false;
            } else if (cmp == 0) {
                multiple = true;
            }
        }
        if (multiple) {
            if (bestMatch.getExact() == paramCount - 1) {
                // Only one parameter is not an exact match - try using the
                // super class
                match = resolveAmbiguousWrapper(candidates.keySet(), paramTypes);
            } else {
                match = null;
            }

            if (match == null) {
                // If multiple methods have the same matching number of parameters
                // the match is ambiguous so throw an exception
                throw new MethodNotFoundException(message(
                        null, "util.method.ambiguous", clazz, name,
                        paramString(paramTypes)));
                }
        }

        // Handle case where no match at all was found
        if (match == null) {
            throw new MethodNotFoundException(message(
                        null, "util.method.notfound", clazz, name,
                        paramString(paramTypes)));
        }

        return match;
    }
826941
public static ModelWrapper wrap(Object model) {
        if (!(isModel(model.getClass()))) {
            throw new IllegalArgumentException("The given object is no model");
        }
        return new ModelWrapper((OpenEngSBModel) model);
    }
1224294
public static boolean isWrapper(Class<?> type) {

        if (Boolean.class == type) {
            return true;
        } 
        if (Byte.class == type) {
            return true;
        } 
        if (Character.class == type) {
            return true;
        } 
        if (Short.class == type) {
            return true;
        } 
        if (Integer.class == type) {
            return true;
        } 
        if (Long.class == type) {
            return true;
        }
        if (Float.class == type) {
            return true;
        } 
        if (Double.class == type) {
            return true;
        }
        return false;
    }