public DataBinding getDataBinding(String id) { if (id == null) { return null; } loadDataBindings(); DataBinding dataBinding = bindings.get(id.toLowerCase()); if (dataBinding == null) { loadDataBindings(); dataBinding = bindings.get(id.toLowerCase()); } return dataBinding; }
public boolean introspectType(DataType dataType, Operation operation) { loadDataBindings(); for (DataBinding binding : databindings) { introspectArray(dataType, operation); return true; } else if (Throwable.class.isAssignableFrom(physical)) {
private boolean introspectArray(DataType dataType, Operation operation) { Class<?> physical = dataType.getPhysical(); if (!physical.isArray() || physical == byte[].class) { return false; } Class<?> componentType = physical.getComponentType(); Type genericComponentType = componentType; if(dataType.getGenericType() instanceof GenericArrayType) { genericComponentType = ((GenericArrayType) dataType.getGenericType()).getGenericComponentType(); } DataType logical = new DataTypeImpl(dataType.getDataBinding(), componentType, genericComponentType, dataType.getLogical()); introspectType(logical, operation); dataType.setDataBinding("java:array"); dataType.setLogical(logical); return true; }
/** * Dynamically load data bindings declared under META-INF/services */ private synchronized void loadDataBindings() { if (loadedDataBindings) return; // Get the databinding service declarations Collection<ServiceDeclaration> dataBindingDeclarations; try { dataBindingDeclarations = registry.getServiceDiscovery().getServiceDeclarations(DataBinding.class.getName()); } catch (IOException e) { throw new IllegalStateException(e); } // Load data bindings for (ServiceDeclaration dataBindingDeclaration : dataBindingDeclarations) { Map<String, String> attributes = dataBindingDeclaration.getAttributes(); String name = attributes.get("name"); // Create a data binding wrapper and register it DataBinding dataBinding = new LazyDataBinding(name, dataBindingDeclaration); addDataBinding(dataBinding); } loadedDataBindings = true; }
public boolean introspectType(DataType dataType, Operation operation) { loadDataBindings(); for (DataBinding binding : databindings) { introspectArray(dataType, operation); return true; } else if (Throwable.class.isAssignableFrom(physical)) {
private boolean introspectArray(DataType dataType, Operation operation) { Class<?> physical = dataType.getPhysical(); if (!physical.isArray() || physical == byte[].class) { return false; } Class<?> componentType = physical.getComponentType(); Type genericComponentType = componentType; if(dataType.getGenericType() instanceof GenericArrayType) { genericComponentType = ((GenericArrayType) dataType.getGenericType()).getGenericComponentType(); } DataType logical = new DataTypeImpl(dataType.getDataBinding(), componentType, genericComponentType, dataType.getLogical()); introspectType(logical, operation); dataType.setDataBinding("java:array"); dataType.setLogical(logical); return true; }
/** * Dynamically load data bindings declared under META-INF/services */ private synchronized void loadDataBindings() { if (loadedDataBindings) return; // Get the databinding service declarations Collection<ServiceDeclaration> dataBindingDeclarations; try { dataBindingDeclarations = registry.getServiceDiscovery().getServiceDeclarations(DataBinding.class.getName()); } catch (IOException e) { throw new IllegalStateException(e); } // Load data bindings for (ServiceDeclaration dataBindingDeclaration : dataBindingDeclarations) { Map<String, String> attributes = dataBindingDeclaration.getAttributes(); String name = attributes.get("name"); // Create a data binding wrapper and register it DataBinding dataBinding = new LazyDataBinding(name, dataBindingDeclaration); addDataBinding(dataBinding); } loadedDataBindings = true; }
public DataBinding getDataBinding(String id) { if (id == null) { return null; } loadDataBindings(); DataBinding dataBinding = bindings.get(id.toLowerCase()); if (dataBinding == null) { loadDataBindings(); dataBinding = bindings.get(id.toLowerCase()); } return dataBinding; }
public DataType introspectType(Object value, Operation operation) { loadDataBindings(); DataType dataType = null; for (DataBinding binding : databindings) { // don't introspect for JavaBeansDatabinding as all javatypes will // anyways match to its basetype // which is java.lang.Object. Default to this only if no databinding // results if (!binding.getName().equals(JavaBeansDataBinding.NAME)) { dataType = binding.introspect(value, operation); } if (dataType != null) { return dataType; } } return new DataTypeImpl<XMLType>(JavaBeansDataBinding.NAME, value.getClass(), XMLType.UNKNOWN); } }
public DataType introspectType(Object value, Operation operation) { loadDataBindings(); DataType dataType = null; for (DataBinding binding : databindings) { // don't introspect for JavaBeansDatabinding as all javatypes will // anyways match to its basetype // which is java.lang.Object. Default to this only if no databinding // results if (!binding.getName().equals(JavaBeansDataBinding.NAME)) { dataType = binding.introspect(value, operation); } if (dataType != null) { return dataType; } } return new DataTypeImpl<XMLType>(JavaBeansDataBinding.NAME, value.getClass(), XMLType.UNKNOWN); } }