/** * @author Vince Bickers */ public class Comment extends Activity { @Property(name = "remark") private String comment; public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isNotTraditionalGetter(method)) { log.warn("QueryResult interface method " + method.getName() + " doesn't appear to be a getter and therefore may not return the correct result."); } if (method.isAnnotationPresent(Property.class)) { Property annotation = method.getAnnotation(Property.class); return Utils.coerceTypes(method.getReturnType(), data.get(annotation.name())); } Matcher matcher = beanGetterPattern.matcher(method.getName()); if (matcher.matches()) { String propertyKey = matcher.group(2); propertyKey = propertyKey.substring(0, 1).toLowerCase().concat(propertyKey.substring(1)); return Utils.coerceTypes(method.getReturnType(), data.get(propertyKey)); } return Utils.coerceTypes(method.getReturnType(), data.get(method.getName())); }
/** * This object is entirely hydrated via its fields * * @author Vince Bickers */ public class Location extends DomainObject { @Property("location") private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isNotTraditionalGetter(method)) { log.warn("QueryResult interface method " + method.getName() + " doesn't appear to be a getter and therefore may not return the correct result."); } if (method.isAnnotationPresent(Property.class)) { Property annotation = method.getAnnotation(Property.class); return Utils.coerceTypes(method.getReturnType(), data.get(annotation.name())); } Matcher matcher = beanGetterPattern.matcher(method.getName()); if (matcher.matches()) { String propertyKey = matcher.group(2); propertyKey = propertyKey.substring(0, 1).toLowerCase().concat(propertyKey.substring(1)); return Utils.coerceTypes(method.getReturnType(), data.get(propertyKey)); } return Utils.coerceTypes(method.getReturnType(), data.get(method.getName())); }
/** * This object is entirely hydrated via its setters * * @author Vince Bickers */ public class Orbit extends DomainObject { @Property("orbit") private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
/** * @author Luanne Misquitta */ public class Studio { private Long id; @Property(name = "studio-name") private String name; public Studio() { } public Studio(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getId() { return id; } }
/** * @author Vince Bickers */ // todo: default label and another in the class hierarchy... //@Label public abstract class Membership implements IMembership { @Property(name = "annualFees") private Integer fees; private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getFees() { return fees; } public void setFees(Integer fees) { this.fees = fees; } }
private Long entityId; @Property(name = "src_port") private int srcPort; @Property(name = "dst_port") private int dstPort; @Property(name = "src_switch") @Convert(graphPropertyType = String.class) private SwitchId srcSwitchId; @Property(name = "dst_switch") @Convert(graphPropertyType = String.class) private SwitchId dstSwitchId; @Property(name = "max_bandwidth") private Long maxBandwidth; @Property(name = "time_create") @Convert(InstantStringConverter.class) private Instant timeCreate; @Property(name = "time_modify") @Convert(InstantStringConverter.class) private Instant timeModify;
@Property(name = "flowid") @Required private String flowId; @Property(name = "cookie") @Required private long cookie; @Property(name = "parent_cookie") @Setter(AccessLevel.NONE) @Getter(AccessLevel.NONE) @Property(name = "src_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "src_port") private int srcPort; @Property(name = "dst_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "dst_port") private int destPort; @Property(name = "ignore_bandwidth") private boolean ignoreBandwidth;
@Property(name = "src_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "src_port") private int srcPort; @Property(name = "dst_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "dst_port") private int destPort; @Property(name = "max_bandwidth") private long maxBandwidth; @Property(name = "default_max_bandwidth") private long defaultMaxBandwidth; @Property(name = "available_bandwidth") private long availableBandwidth; @Property(name = "status") @Property(name = "actual") @Property(name = "time_create") @Convert(InstantStringConverter.class)
@Property(name = "flowid") @Required private String flowId; @Property(name = "cookie") @Required private long cookie; @Property(name = "src_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "src_port") private int srcPort; @Property(name = "src_vlan") private int srcVlan; @Property(name = "dst_switch") @Convert(graphPropertyType = String.class) @Setter(AccessLevel.NONE) @Property(name = "dst_port") private int destPort; @Property(name = "dst_vlan") private int destVlan; @Property(name = "flowpath")
/** * @author Mihai Raulea * @author Luanne Misquitta */ public class Pizza { public Long id; public Risk strokeRisk; @Convert(RiskConverter.class) public Risk diabetesRisk; @Property(name = "riskCancer") public Risk cancerRisk; @Convert(RiskConverter.class) @Property(name = "riskHT") public Risk hypertensionRisk; }
/** * @author Luanne Misquitta */ public class Pizza { public Long id; public Risk strokeRisk; @Convert(RiskConverter.class) public Risk diabetesRisk; @Property(name = "riskCancer") public Risk cancerRisk; @Convert(RiskConverter.class) @Property(name = "riskHT") public Risk hypertensionRisk; public RoundingMode roundingMode; //a java enum, to test that these are converted too }
/** * @author Vince Bickers */ @NodeEntity(label = "Space_Program") public class Program extends DomainObject { @Property("program") private String name; private List<Satellite> satellites; public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Satellite> getSatellites() { return satellites; } public void setSatellites(List<Satellite> satellites) { this.satellites = satellites; } }
@Property private Year yearOfRegistration;
public class PropertyAndConvertTogether { @Id @GeneratedValue private Long id; @Convert(LocationConverter.class) @Property private Location location; }
@Property(name = "testProp") String annotatedTestProperty; Double nonAnnotatedTestProperty; boolean nonAnnotatedTestPropertyAccessorWasCalled; @Property(name = "testAnnoProp") String fullyAnnotatedProperty; @Property(name = "testIgnored") String propertyMethodsIgnored; @Property(name = "differentAnnotationOnGetter") String propertyWithDifferentAnnotatedGetter; boolean fullyAnnotatedPropertyAccessorWasCalled;