/** * Get a PathBuilder instance for the given property * * @param property property name * @return */ @SuppressWarnings("unchecked") public PathBuilder<Object> get(String property) { PathBuilder<Object> path = (PathBuilder) properties.get(property); if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); properties.put(property, path); } return path; }
/** * Get a PathBuilder for the given property with the given type * * @param <A> * @param property property name * @param type * @return */ @SuppressWarnings("unchecked") public <A> PathBuilder<A> get(String property, Class<A> type) { PathBuilder<A> path = (PathBuilder<A>) properties.get(property); if (path == null || !type.isAssignableFrom(path.getType())) { Class<? extends A> vtype = validate(property, type); path = new PathBuilder<A>(vtype, forProperty(property), validator); properties.put(property, path); } return path; }