• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

link-intersystems / lis-commons / #313

11 May 2024 05:18AM UTC coverage: 90.142%. Remained the same
#313

push

renelink
Added documentation.

7882 of 8744 relevant lines covered (90.14%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/lis-commons-beans-records/src/main/java/com/link_intersystems/beans/java/record/Introspector.java
1
package com.link_intersystems.beans.java.record;
2

3
import java.beans.BeanInfo;
4
import java.beans.IntrospectionException;
5
import java.beans.PropertyDescriptor;
6

7
/**
8
 * An {@link java.beans.Introspector} like implementation that provides {@link BeanInfo} on Java record types.
9
 * <p>
10
 * Each record field will be recognized as a bean property. E.g. For a <code>PersonRecord</code>
11
 *
12
 * <pre>
13
 *     public record PersonRecord(String firstname, String lastname) {}
14
 * </pre>
15
 * <p>
16
 * you can obtain a {@link BeanInfo} by calling
17
 *
18
 * <pre>
19
 *     BeanInfo personRecordBeanInfo = Introspector.getBeanInfo(PersonRecord.class);
20
 * </pre>
21
 * <p>
22
 * whose {@link java.beans.PropertyDescriptor}s refer to the record fields.
23
 *
24
 * <pre>
25
 *     PropertyDescriptor[] propertyDescriptors = personRecordBeanInfo.getPropertyDescriptors();
26
 *
27
 *     assertEquals(2, propertyDescriptors.length()); // the firstname and lastname field of the PersonRecord
28
 * </pre>
29
 * <p>
30
 * Since a Java record is a value object and therefore all fields are immutable, all
31
 * {@link PropertyDescriptor#getWriteMethod()} calls will return <code>null</code>.
32
 */
33
public class Introspector {
×
34

35
    public static BeanInfo getBeanInfo(Class<?> recordType) throws IntrospectionException {
36
        return new RecordBeanInfo(recordType);
1✔
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc