/** * Create a PathBuilder instance for the given property * * @param property property name * @return property path */ @SuppressWarnings("unchecked") public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<Object>) existingPath; }
/** * Create a PathBuilder for the given property with the given type * * @param <A> * @param property property name * @param type property type * @return property path */ @SuppressWarnings("unchecked") public <A> PathBuilder<A> get(String property, Class<A> type) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, type); PathBuilder<A> path = (PathBuilder<A>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<? extends A> vtype = validate(property, type); path = new PathBuilder<A>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<A>) existingPath; }
/** * Create a PathBuilder instance for the given property * * @param property property name * @return property path */ @SuppressWarnings("unchecked") public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<Object>) existingPath; }
/** * Create a PathBuilder for the given property with the given type * * @param <A> * @param property property name * @param type property type * @return property path */ @SuppressWarnings("unchecked") public <A> PathBuilder<A> get(String property, Class<A> type) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, type); PathBuilder<A> path = (PathBuilder<A>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<? extends A> vtype = validate(property, type); path = new PathBuilder<A>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<A>) existingPath; }