scannedClass.processed(servicesTags); for (final ClassAnnotation cad : servicesTags) { final ClassAnnotation[] values = (ClassAnnotation[]) cad.getValue("value"); if (values != null) { allServiceTags.addAll(Arrays.asList(values)); scannedClass.processed(referencesClassTags); for (final ClassAnnotation cad : referencesClassTags) { final ClassAnnotation[] values = (ClassAnnotation[]) cad.getValue("value"); if (values != null) { createReferences(Arrays.asList(values), describedClass); scannedClass.processed(propsClassTags); for (final ClassAnnotation cad : propsClassTags) { final ClassAnnotation[] values = (ClassAnnotation[]) cad.getValue("value"); if (values != null) { createProperties(Arrays.asList(values), describedClass);
/** * Generates a property descriptor of type {@link PropertyType#String} */ private void generateStringPropertyDescriptor(final ClassAnnotation cad, final ClassDescription classDescription, final boolean metatype, String annotationName, String propertyDescriptorName) { final String[] values = (String[]) cad.getValue(annotationName); if (values == null) { return; } final PropertyDescription pd = new PropertyDescription(cad); pd.setName(propertyDescriptorName); pd.setMultiValue(values); pd.setType(PropertyType.String); if (metatype) { pd.setPrivate(true); } classDescription.add(pd); }
if (cad.getValue("enabled") != null) { component.setEnabled(cad.getBooleanValue("enabled", true)); if (cad.getValue("specVersion") != null) { component.setSpecVersion(SpecVersion.fromName(cad.getValue("specVersion").toString())); if (cad.getValue("immediate") != null) { component.setImmediate(cad.getBooleanValue("immediate", false));
final Object val = cad.getValue("scope"); if ( val != null ) { if ( val instanceof String[] ) {
private boolean isLongDefaultValue(final ClassAnnotation cad, String propName) { Object value = cad.getValue(propName); return value == null || ((Long) value) == -1; }
/** Generates a property descriptor of type {@link PropertyType} */ private void generatePropertyDescriptor(final ClassAnnotation cad, final ClassDescription classDescription, final boolean metatype, final String propertyName, final String propertyDescriptorName, PropertyType propertyType, String label, String description, boolean isArray) { final PropertyDescription pd = new PropertyDescription(cad); pd.setName(propertyDescriptorName); pd.setLabel(label); pd.setDescription(description); pd.setType(propertyType); if(isArray) { final String[] values = (String[]) cad.getValue(propertyName); pd.setMultiValue(values); pd.setUnbounded(PropertyUnbounded.ARRAY); pd.setCardinality(Integer.MAX_VALUE); } else { final Object propertyVal = cad.getValue(propertyName); String pdValue = (propertyVal instanceof String) ? (String) propertyVal : propertyVal!=null ? propertyVal.toString() : null; pd.setValue(pdValue); pd.setUnbounded(PropertyUnbounded.DEFAULT); } if (!metatype) { pd.setPrivate(true); } classDescription.add(pd); }
final String[] interfaces = (String[]) cad.getValue("service"); if ( interfaces != null ) { for (final String t : interfaces) { if (cad.getValue("enabled") != null) { component.setEnabled(cad.getBooleanValue("enabled", true)); if (cad.getValue("immediate") != null) { component.setImmediate(cad.getBooleanValue("immediate", false)); final String[] property = (String[])cad.getValue("property"); if ( property != null ) { if (cad.getValue("xmlns") != null) { final SpecVersion spec = SpecVersion.fromNamespaceUrl(cad.getValue("xmlns").toString()); if ( spec == null ) { throw new SCRDescriptorException("Unknown xmlns attribute value: " + cad.getValue("xmlns"), describedClass.getSource()); Object configPid = cad.getValue("configurationPid"); if ( configPid instanceof String ) { component.setConfigurationPid((String)configPid);
cd.setSetMetatypeFactoryPid(cad.getBooleanValue("configurationFactory", false)); String nameFromAnnotation = (String) cad.getValue("name"); String defaultLabel = "Sling Health Check: " + (nameFromAnnotation!=null ? nameFromAnnotation : nameOfAnnotatedClass); cd.setLabel(cad.getStringValue("label", defaultLabel)); if (cad.getValue(resultCacheTtlInMsPropName) != null) { generatePropertyDescriptor(cad, classDescription, metatype, resultCacheTtlInMsPropName, HealthCheck.RESULT_CACHE_TTL_IN_MS, PropertyType.Long, "Result Cache TTL", if (cad.getValue(warningsStickForMinutesPropName) != null) { generatePropertyDescriptor(cad, classDescription, metatype, warningsStickForMinutesPropName, "hc.warningsStickForMinutes" /* use constant once API is released */,