What's new? | Help | Directory | Sign in
Google
google-singleton-detector
Find singletons and global state in Java programs
  
  
  
  
    
Search
for
Updated Apr 29, 2008 by PaulHammant
Hingleton  
Information about the 'Hingleton' types.

Hingleton

Description

Derived from “helper singleton,” a Hingleton is a class which turns another class into a singleton by enforcing that class's singularity. The offending class is the Hingleton, which "hingles" the other class.

Criteria

Hingletons have a public static method that returns an instance of a non-primitive object, and they have at least one private static non-final field of the same type.

Example

public class Hingleton {
  private static Foo instance;

  public static Foo getInstance() {
    if (instance == null) {
      instance = new Foo();
    }
    return instance;
  }
}

(Hingleton hingles Foo)

For the purposes of detection, we are not interested in whether or not there is:


Comment by neuromancer977, Sep 12, 2007

syncronized missing? huh


Sign in to add a comment