List of usage examples for java.lang.reflect Proxy isProxyClass
public static boolean isProxyClass(Class<?> cl)
From source file:jp.go.nict.langrid.servicecontainer.handler.jsonrpc.servlet.JsonRpcServlet.java
private static String prettyName(Class<?> clazz) { StringBuilder postfix = new StringBuilder(); if (Proxy.isProxyClass(clazz)) { return "<em>Proxy Implementation (detailed information unavailable)</em>"; }/*from w ww . j av a2 s . c om*/ if (clazz.isArray()) { clazz = clazz.getComponentType(); appendGenericsInfo(clazz, postfix); postfix.append("[]"); } else { appendGenericsInfo(clazz, postfix); } String n = clazz.getName(); String sn = clazz.getSimpleName(); return "<span class=\"info\">" + sn + postfix + "<span>" + n + postfix + "</span></span>"; }
From source file:org.apache.olingo.ext.proxy.commons.AbstractStructuredInvocationHandler.java
protected AbstractStructuredInvocationHandler getStructuredInvocationHandler(final Object value) { if (value != null && Proxy.isProxyClass(value.getClass())) { InvocationHandler invocationHandler = Proxy.getInvocationHandler(value); if (invocationHandler instanceof AbstractStructuredInvocationHandler) { return (AbstractStructuredInvocationHandler) invocationHandler; }/*from ww w . j av a 2 s . c o m*/ } return null; }
From source file:org.apache.jena.permissions.impl.SecuredItemImpl.java
@Override public boolean equals(final Object o) { if (Proxy.isProxyClass(o.getClass())) { return o.equals(itemHolder.getSecuredItem()); } else {//from w ww . j ava 2s . c o m if (o instanceof SecuredItemImpl) { return itemHolder.getBaseItem().equals(((SecuredItemImpl) o).getBaseItem()); } return false; } }
From source file:org.geoserver.catalog.ResourcePool.java
/** * Returns true if this object is saved in the catalog and not a modified proxy. We don't want to * cache the result of computations made against a dirty object, nor the ones made against an * object that still haven't been saved/*from w w w . ja v a 2s .c om*/ * @param info * @return */ boolean isCacheable(CatalogInfo info) { // saved? if (info.getId() == null) { return false; } // dirty? if (Proxy.isProxyClass(info.getClass())) { Object invocationHandler = Proxy.getInvocationHandler(info); if (invocationHandler instanceof ModificationProxy && ((ModificationProxy) invocationHandler).isDirty()) { return false; } } return true; }
From source file:org.geoserver.catalog.ResourcePool.java
AttributeDescriptor handleDescriptor(AttributeDescriptor ad, FeatureTypeInfo info) { // force the user specified CRS if the data has no CRS, or reproject it // if necessary if (ad instanceof GeometryDescriptor) { GeometryDescriptor old = (GeometryDescriptor) ad; try {//from w w w . j av a 2 s.com //if old has no crs, change the projection handlign policy // to be the declared boolean rebuild = false; if (old.getCoordinateReferenceSystem() == null) { //(JD) TODO: this is kind of wierd... we should at least // log something here, and this is not thread safe!! if (info.getProjectionPolicy() != ProjectionPolicy.FORCE_DECLARED) { // modify the actual type info if possible, not the modification // proxy around it if (Proxy.isProxyClass(info.getClass())) { FeatureTypeInfo inner = ModificationProxy.unwrap(info); inner.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); } else { info.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); } } rebuild = true; } else { ProjectionPolicy projPolicy = info.getProjectionPolicy(); if (projPolicy == ProjectionPolicy.REPROJECT_TO_DECLARED || projPolicy == ProjectionPolicy.FORCE_DECLARED) { rebuild = true; } } if (rebuild) { //rebuild with proper crs AttributeTypeBuilder b = new AttributeTypeBuilder(); b.init(old); b.setCRS(getCRS(info.getSRS())); ad = b.buildDescriptor(old.getLocalName()); } } catch (Exception e) { //log exception } } return ad; }
From source file:org.geoserver.catalog.hibernate.HibCatalogImpl.java
@SuppressWarnings("unchecked") protected void saved(CatalogInfo object) { // this object is a proxy if (!Proxy.isProxyClass(object.getClass())) { LOGGER.severe("WORKAROUND: CatalogInfo object is a " + object.getClass().getSimpleName() + " -- Faking delta values in fireModified()"); // fire out what changed List propertyNames = new ArrayList(); List newValues = new ArrayList(); List oldValues = new ArrayList(); // TODO: protect this original object, perhaps with another proxy fireModified(object, propertyNames, oldValues, newValues); firePostModified(object);//from w w w . ja v a 2s. c o m return; } ModificationProxy h = (ModificationProxy) Proxy.getInvocationHandler(object); // get the real object CatalogInfo real = (CatalogInfo) h.getProxyObject(); // fire out what changed List propertyNames = h.getPropertyNames(); List newValues = h.getNewValues(); List oldValues = h.getOldValues(); // TODO: protect this original object, perhaps with another proxy fireModified(real, propertyNames, oldValues, newValues); // commit to the original object h.commit(); // resolve to do a sync on the object // syncIdWithName(real); // fire the post modify event firePostModified(real); }