@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getDeclaringClass() == Object.class) { return method.invoke(this); } String name = Syntax.toProperty(method); Object value = attrs.getTyped(name); if (value == null) { if (method.getDefaultValue() != null) { return method.getDefaultValue(); } if (args != null && args.length == 1) { return args[0]; } } return ProcessorHandler.converter.convertNeverNull(method.getGenericReturnType(), value); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getDeclaringClass() == Object.class) { return method.invoke(this); } String name = Syntax.toProperty(method); Object value = attrs.getTyped(name); if (value == null) { if (method.getDefaultValue() != null) { return method.getDefaultValue(); } if (args != null && args.length == 1) { return args[0]; } } return ProcessorHandler.converter.convertNeverNull(method.getGenericReturnType(), value); }
public static void copyAttribsToBuilder(CapReqBuilder builder, Attrs attribs) { for (Entry<String,String> attrib : attribs.entrySet()) { String key = attrib.getKey(); if (key.endsWith(":")) { String directiveName = key.substring(0, key.length() - 1); builder.addDirective(directiveName, attrib.getValue()); } else { // TODO Type type = attribs.getType(key); Object value = attribs.getTyped(key); builder.addAttribute(key, value); } } }
public static void copyAttribsToBuilder(CapReqBuilder builder, Attrs attribs) { for (Entry<String,String> attrib : attribs.entrySet()) { String key = attrib.getKey(); if (key.endsWith(":")) { String directiveName = key.substring(0, key.length() - 1); builder.addDirective(directiveName, attrib.getValue()); } else { // TODO Type type = attribs.getType(key); Object value = attribs.getTyped(key); builder.addAttribute(key, value); } } }
public static CapReqBuilder createCapReqBuilder(String namespace, Attrs attrs) throws Exception { CapReqBuilder builder = new CapReqBuilder(namespace); for (String key : attrs.keySet()) { if (key.endsWith(":")) { String value = attrs.get(key); key = key.substring(0, key.length() - 1); builder.addDirective(key, value); } else { Object value = attrs.getTyped(key); builder.addAttribute(key, value); } } return builder; }
/** * In bnd, we only use one map for both directives & attributes. This method * will properly dispatch them AND take care of typing * * @param attrs * @throws Exception */ public void addAttributesOrDirectives(Attrs attrs) throws Exception { for (Entry<String, String> e : attrs.entrySet()) { String directive = Attrs.toDirective(e.getKey()); if (directive != null) { addDirective(directive, e.getValue()); } else { Object typed = attrs.getTyped(e.getKey()); if (typed instanceof aQute.bnd.version.Version) { typed = new Version(typed.toString()); } addAttribute(e.getKey(), typed); } } }
public static CapReqBuilder createCapReqBuilder(String namespace, Attrs attrs) throws Exception { CapReqBuilder builder = new CapReqBuilder(namespace); for (String key : attrs.keySet()) { if (key.endsWith(":")) { String value = attrs.get(key); key = key.substring(0, key.length() - 1); builder.addDirective(key, value); } else { Object value = attrs.getTyped(key); builder.addAttribute(key, value); } } return builder; }
/** * In bnd, we only use one map for both directives & attributes. This method * will properly dispatch them AND take care of typing * * @param attrs * @throws Exception */ public void addAttributesOrDirectives(Attrs attrs) throws Exception { for (Entry<String, String> e : attrs.entrySet()) { String directive = Attrs.toDirective(e.getKey()); if (directive != null) { addDirective(directive, e.getValue()); } else { Object typed = attrs.getTyped(e.getKey()); if (typed instanceof aQute.bnd.version.Version) { typed = new Version(typed.toString()); } addAttribute(e.getKey(), typed); } } }
private static void doOr(FilterBuilder sb, String key, String attribute, Attrs attrs) throws Exception { sb.or(); while (attrs.containsKey(key)) { String[] names = Converter.cnv(String[].class, attrs.getTyped(key)); for (String name : names) { sb.approximate(attribute, name); } key += "~"; } sb.endOr(); }
private static void doOr(FilterBuilder sb, String key, String attribute, Attrs attrs) throws Exception { sb.or(); while (attrs.containsKey(key)) { String[] names = Converter.cnv(String[].class, attrs.getTyped(key)); for (String name : names) { sb.approximate(attribute, name); } key += "~"; } sb.endOr(); }
c.version = (Version) capabilityAttrs.getTyped(ContractNamespace.CAPABILITY_VERSION_ATTRIBUTE); c.from = from;
c.version = (Version) capabilityAttrs.getTyped(ContractNamespace.CAPABILITY_VERSION_ATTRIBUTE); c.from = from;
.keySet()) { Object value = entry.getValue() .getTyped(key); key = Processor.removeDuplicateMarker(key);
.keySet()) { Object value = entry.getValue() .getTyped(key); key = Processor.removeDuplicateMarker(key);