示例#1
0
 /**
  * Constructor for the <code>CompositeKey</code> object. This will create an object capable of
  * reading an writing composite keys from an XML element. This also allows a parent element to be
  * created to wrap the key object if desired.
  *
  * @param context this is the root context for the serialization
  * @param entry this is the entry object used for configuration
  * @param type this is the type of object the key represents
  */
 public CompositeKey(Context context, Entry entry, Type type) throws Exception {
   this.root = new Traverser(context);
   this.style = context.getStyle();
   this.context = context;
   this.entry = entry;
   this.type = type;
 }
  /**
   * This is used to acquire the name of the element or attribute that is used by the class schema.
   * The name is determined by checking for an override within the annotation. If it contains a name
   * then that is used, if however the annotation does not specify a name the the field or method
   * name is used instead.
   *
   * @param context this is the context used to style the name
   * @return returns the name that is used for the XML property
   */
  public String getName(Context context) throws Exception {
    Style style = context.getStyle();

    if (attribute) {
      return style.getAttribute(name);
    }
    return style.getElement(name);
  }
 public String getName(Context paramContext) {
   return paramContext.getStyle().getElement(detail.getName());
 }
 private String getEntry(Context paramContext) {
   return paramContext.getStyle().getElement(getEntry());
 }
  /**
   * This is used to acquire the name of the element or attribute that is used by the class schema.
   * The name is determined by checking for an override within the annotation. If it contains a name
   * then that is used, if however the annotation does not specify a name the the field or method
   * name is used instead.
   *
   * @param context this is the context used to style the name
   * @return returns the name that is used for the XML property
   */
  public String getName(Context context) throws Exception {
    Style style = context.getStyle();
    String name = detail.getName();

    return style.getElement(name);
  }
  /**
   * This is used to either provide the entry value provided within the annotation or compute a
   * entry value. If the entry string is not provided the the entry value is calculated as the type
   * of primitive the object is as a simplified class name.
   *
   * @param context this is the context used to style the entry
   * @return this returns the name of the XML entry element used
   */
  private String getEntry(Context context) throws Exception {
    Style style = context.getStyle();
    String entry = getEntry();

    return style.getElement(entry);
  }