Java Code Examples for org.apache.tomcat.util.IntrospectionUtils#getProperty()
The following examples show how to use
org.apache.tomcat.util.IntrospectionUtils#getProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StoreAppender.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Check if the attribute should be printed. * @param desc RegistryDescriptor from this bean * @param descriptor PropertyDescriptor from this bean property * @param attributeName The attribute name to store * @param bean The current bean * @param bean2 A default instance of the bean for comparison * @return null if the value should be skipped, the value to print otherwise */ protected Object checkAttribute(StoreDescription desc, PropertyDescriptor descriptor, String attributeName, Object bean, Object bean2) { if (descriptor instanceof IndexedPropertyDescriptor) { return null; // Indexed properties are not persisted } if (!isPersistable(descriptor.getPropertyType()) || (descriptor.getReadMethod() == null) || (descriptor.getWriteMethod() == null)) { return null; // Must be a read-write primitive or String } if (desc.isTransientAttribute(descriptor.getName())) { return null; // Skip the specified exceptions } Object value = IntrospectionUtils.getProperty(bean, descriptor.getName()); if (value == null) { return null; // Null values are not persisted } Object value2 = IntrospectionUtils.getProperty(bean2, descriptor.getName()); if (value.equals(value2)) { // The property has its default value return null; } return value; }
Example 2
Source File: Connector.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Return a property from the protocol handler. * * @param name the property name * @return the property value */ public Object getProperty(String name) { String repl = name; if (replacements.get(name) != null) { repl = replacements.get(name); } return IntrospectionUtils.getProperty(protocolHandler, repl); }
Example 3
Source File: ConnectorMBean.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Obtain and return the value of a specific attribute of this MBean. * * @param name Name of the requested attribute * * @exception AttributeNotFoundException if this attribute is not * supported by this MBean * @exception MBeanException if the initializer of an object * throws an exception * @exception ReflectionException if a Java reflection exception * occurs when invoking the getter */ @Override public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException { // Validate the input parameters if (name == null) { throw new RuntimeOperationsException( new IllegalArgumentException("Attribute name is null"), "Attribute name is null"); } Connector connector = doGetManagedResource(); return IntrospectionUtils.getProperty(connector, name); }
Example 4
Source File: CertificateStoreAppender.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override protected Object checkAttribute(StoreDescription desc, PropertyDescriptor descriptor, String attributeName, Object bean, Object bean2) { if (attributeName.equals("type")) { return IntrospectionUtils.getProperty(bean, descriptor.getName()); } else { return super.checkAttribute(desc, descriptor, attributeName, bean, bean2); } }
Example 5
Source File: AbstractEndpoint.java From Tomcat8-Source-Read with MIT License | 5 votes |
public String getProperty(String name) { String value = (String) getAttribute(name); final String socketName = "socket."; if (value == null && name.startsWith(socketName)) { Object result = IntrospectionUtils.getProperty(socketProperties, name.substring(socketName.length())); if (result != null) { value = result.toString(); } } return value; }
Example 6
Source File: Connector.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Return a configured property. */ public Object getProperty(String name) { String repl = name; if (replacements.get(name) != null) { repl = replacements.get(name); } return IntrospectionUtils.getProperty(protocolHandler, repl); }
Example 7
Source File: Connector.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Return a configured property. */ public Object getProperty(String name) { String repl = name; if (replacements.get(name) != null) { repl = replacements.get(name); } return IntrospectionUtils.getProperty(protocolHandler, repl); }
Example 8
Source File: ConnectorStoreAppender.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Override public void printAttributes(PrintWriter writer, int indent, boolean include, Object bean, StoreDescription desc) throws Exception { // Render a className attribute if requested if (include && desc != null && !desc.isStandard()) { writer.print(" className=\""); writer.print(bean.getClass().getName()); writer.print("\""); } Connector connector = (Connector) bean; String protocol = connector.getProtocol(); List<String> propertyKeys = getPropertyKeys(connector); // Create blank instance Object bean2 = new Connector(protocol);//defaultInstance(bean); for (String key : propertyKeys) { Object value = IntrospectionUtils.getProperty(bean, key); if (desc.isTransientAttribute(key)) { continue; // Skip the specified exceptions } if (value == null) { continue; // Null values are not persisted } if (!isPersistable(value.getClass())) { continue; } Object value2 = IntrospectionUtils.getProperty(bean2, key); if (value.equals(value2)) { // The property has its default value continue; } if (isPrintValue(bean, bean2, key, desc)) { printValue(writer, indent, key, value); } } if (protocol != null && !"HTTP/1.1".equals(protocol)) super.printValue(writer, indent, "protocol", protocol); }