Coder Social home page Coder Social logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Since slim3 doesn't use aop to detect dirty properties, it is reasonable that 
the
values of modify-timestamp-annotated properties will always be overridden by 
slim3.
The programmers have no responsibility for taking care of the
modify-timestamp-annotated properties.

Original comment by [email protected] on 2 May 2010 at 11:19

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
We will prepare AttributeListener for "Automatic Assigned Property" as follows:

public interface AttributeListener<T> {

  /**
   * This method is called before a model is put to datastore.
   * 
   * @param value the original property value
   * @return the automatic assigned value
   */
  T prePut(T value);
}

public class CreatedDate implements AttributeListener<Date> {
  public Date prePut(Date value) {
    if (value != null) {
      return value;
    }
    return new Date();
  }
}

public class UpdatedDate implements AttributeListener<Date> {
  public Date prePut(Date value) {
    return new Date();
  }
}

@Model
public class Xxx {
  ...
  @Attribute(listener = CreatedDate.class)
  private Date createdDate;

  @Attribute(listener = UpdatedDate.class)
  private Date updatedDate;
}

Original comment by [email protected] on 2 May 2010 at 11:43

  • Changed state: Accepted

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024

Original comment by [email protected] on 2 May 2010 at 11:44

  • Added labels: Version-1.0.4
  • Removed labels: Version

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
GJ!
One question: Can I use both listener in one property as below?

@Model
public class Xxx {
  ...
  @Attribute(listener = CreatedDate.class, listener = UpdatedDate.class)
  private Date modifyDate;
}

Original comment by [email protected] on 3 May 2010 at 7:41

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
> One question: Can I use both listener in one property as below?

No you can't. Just one listener.

Original comment by [email protected] on 3 May 2010 at 9:04

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
If I use UpdatedDate.class listener only as below, it seems (from the code) 
that 
modifyDate will be set to current time even upon entity creation (and that's 
what I 
want). Am I right?

@Attribute(listener = UpdatedDate.class)
  private Date modifyDate;

Original comment by [email protected] on 3 May 2010 at 9:16

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Yes. You are right.

Original comment by [email protected] on 3 May 2010 at 9:21

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024

Original comment by [email protected] on 15 May 2010 at 8:07

  • Added labels: Version-1.0.5
  • Removed labels: Version-1.0.4

from slim3.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024

Original comment by [email protected] on 8 Jul 2010 at 9:16

  • Changed state: Fixed

from slim3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.