/** * Loads the mapping from the specified URL with type defaults to 'CastorXmlMapping'. If an entity * resolver was specified, will use the entity resolver to resolve the URL. This method is also * used to load mappings referenced from another mapping or configuration file. * * @param url The URL of the mapping file. * @throws IOException An error occured when reading the mapping file. * @throws MappingException The mapping file is invalid. */ public void loadMapping(final String url) throws IOException, MappingException { loadMapping(url, DEFAULT_SOURCE_TYPE); }
/** * Sets the value of the field to a default value. * * @param target The object to reset * @throws IllegalStateException if the Java object has changed and is no longer supported by this * handler or the handler is not compatible with the Java object */ public void resetValue(final Object target) throws java.lang.IllegalStateException { _handler.resetValue(target); }
public Object toSQL(final Object object) { if ((object == null) || (_convertFrom == null)) { return object; } return _convertFrom.convert(object); }
/** * Creates an instance of a Castor XML specific {@link Mapping} instance. * * @return a Castor XML specific {@link Mapping} instance. */ public Mapping createMapping() { Mapping mapping = new Mapping(); // mapping.setBindingType(BindingType.XML); return mapping; }
/** * Creates a new instance of the object described by this field. * * @param parent The object for which the field is created * @param args the set of constructor arguments * @return A new instance of the field's value * @throws IllegalStateException This field is a simple type and cannot be instantiated */ public Object newInstance(Object parent, Object[] args) throws IllegalStateException { if (_handler instanceof ExtendedFieldHandler) { return ((ExtendedFieldHandler) _handler).newInstance(parent, args); } // -- backward compatibility: ignore arguments return newInstance(parent); }
/** * Sets the FieldDescriptor that this FieldHander is responsibile for. By setting the * FieldDescriptor, it allows the implementation of the FieldHandler methods to obtain information * about the field itself. This allows a particular implementation to become more generic and * reusable. * * @param fieldDesc the FieldDescriptor to set */ public void setFieldDescriptor(FieldDescriptor fieldDesc) { super.setFieldDescriptor(fieldDesc); if (_handler != null) { if (_handler instanceof GeneralizedFieldHandler) { ((GeneralizedFieldHandler) _handler).setFieldDescriptor(fieldDesc); } } }
public static int numberOfExtendingClassDescriptors(final ClassDescriptor classDescriptor) { int numberOfExtendLevels = 1; ClassDescriptor currentClassDescriptor = classDescriptor; while (currentClassDescriptor.getExtends() != null) { currentClassDescriptor = currentClassDescriptor.getExtends(); numberOfExtendLevels++; } return numberOfExtendLevels; }
/** * Deletes all 'cached' mapping loader factories. */ public void clear() { for (MappingLoader mappingLoader : _mappingLoaders) { mappingLoader.clear(); } }
/** * Compares id against id of the specified object. So this * method is inconsistent with {@link #equals(Object)}. * * @param other Object to be compared with this instance. * @return A negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. */ public int compareTo(final Object other) { return compareTo((AccessMode) other); }
/** * {@inheritDoc} */ public ClassLoader getClassLoader() { return _mappingLoader.getClassLoader(); } }
/** * Loads the mapping from the specified input source with type defaults to 'CastorXmlMapping'. * * @param source The input source. */ public void loadMapping(final InputSource source) { loadMapping(source, DEFAULT_SOURCE_TYPE); }
/** * Creates an instance of a Castor XML specific {@link Mapping} instance. * @return a Castor XML specific {@link Mapping} instance. */ public Mapping createMapping() { Mapping mapping = new Mapping(); // mapping.setBindingType(BindingType.XML); return mapping; }
public Object toJava(final Object object) { if ((object == null) || (_convertTo == null)) { return object; } return _convertTo.convert(object); } }
/** * Sets the value of the field to a default value. * * @param target The object * @throws IllegalStateException The Java object has changed and is no * longer supported by this handler, or the handler is not * compatiable with the Java object */ public void resetValue(final Object target) throws java.lang.IllegalStateException { _handler.resetValue(target); }
/** * Loads the mapping from the specified input source with type defaults to * 'CastorXmlMapping'. * * @param source The input source. */ public void loadMapping(final InputSource source) { loadMapping(source, DEFAULT_SOURCE_TYPE); }
private Object idToSQL(final int index, final Object object) { if ((object == null) || (_leftFrom[index] == null)) { return object; } return _leftFrom[index].convert(object); }
/** * Sets the value of the field to a default value. * * @param target The object * @throws IllegalStateException The Java object has changed and is no longer supported by this * handler, or the handler is not compatiable with the Java object */ public void resetValue(final Object target) throws java.lang.IllegalStateException { _handler.resetValue(target); }
/** * Loads the mapping from the specified URL with type defaults to 'CastorXmlMapping'. * * @param url The URL of the mapping file. * @throws IOException An error occured when reading the mapping file. * @throws MappingException The mapping file is invalid. */ public void loadMapping(final URL url) throws IOException, MappingException { loadMapping(url, DEFAULT_SOURCE_TYPE); }
/** * Method to translate java data types to sql data types. * * @param object Object to be translated to sql data type. * @return Object converted to sql data type. */ protected Object toSQL(final Object object) { if ((object == null) || (_convertFrom == null)) { return object; } return _convertFrom.convert(object); }
/** * Sets the value of the field to a default value. * * @param target The object to reset * @throws IllegalStateException if the Java object has changed and is no * longer supported by this handler or the handler is not * compatible with the Java object */ public void resetValue(final Object target) throws java.lang.IllegalStateException { _handler.resetValue(target); }