/** * Returns the object managed by this initializer. This implementation just * returns the object passed to the constructor. * * @return the object managed by this initializer * @throws ConcurrentException if an error occurs */ @Override public T get() throws ConcurrentException { return getObject(); }
/** * Compares this object with another one. This implementation returns * <b>true</b> if and only if the passed in object is an instance of * {@code ConstantInitializer} which refers to an object equals to the * object managed by this instance. * * @param obj the object to compare to * @return a flag whether the objects are equal */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ConstantInitializer<?>)) { return false; } final ConstantInitializer<?> c = (ConstantInitializer<?>) obj; return Objects.equals(getObject(), c.getObject()); }
/** * Returns a string representation for this object. This string also * contains a string representation of the object managed by this * initializer. * * @return a string for this object */ @Override public String toString() { return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)), String.valueOf(getObject())); } }
/** * Tests whether the correct object is returned. */ @Test public void testGetObject() { assertEquals("Wrong object", VALUE, init.getObject()); }
/** * Returns the object managed by this initializer. This implementation just * returns the object passed to the constructor. * * @return the object managed by this initializer * @throws ConcurrentException if an error occurs */ @Override public T get() throws ConcurrentException { return getObject(); }
/** * Returns the object managed by this initializer. This implementation just * returns the object passed to the constructor. * * @return the object managed by this initializer * @throws ConcurrentException if an error occurs */ @Override public T get() throws ConcurrentException { return getObject(); }
/** * Returns the object managed by this initializer. This implementation just * returns the object passed to the constructor. * * @return the object managed by this initializer * @throws ConcurrentException if an error occurs */ @Override public T get() throws ConcurrentException { return getObject(); }
/** * Compares this object with another one. This implementation returns * <b>true</b> if and only if the passed in object is an instance of * {@code ConstantInitializer} which refers to an object equals to the * object managed by this instance. * * @param obj the object to compare to * @return a flag whether the objects are equal */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ConstantInitializer<?>)) { return false; } final ConstantInitializer<?> c = (ConstantInitializer<?>) obj; return Objects.equals(getObject(), c.getObject()); }
/** * Compares this object with another one. This implementation returns * <b>true</b> if and only if the passed in object is an instance of * {@code ConstantInitializer} which refers to an object equals to the * object managed by this instance. * * @param obj the object to compare to * @return a flag whether the objects are equal */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ConstantInitializer<?>)) { return false; } final ConstantInitializer<?> c = (ConstantInitializer<?>) obj; return Objects.equals(getObject(), c.getObject()); }
/** * Compares this object with another one. This implementation returns * <b>true</b> if and only if the passed in object is an instance of * {@code ConstantInitializer} which refers to an object equals to the * object managed by this instance. * * @param obj the object to compare to * @return a flag whether the objects are equal */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ConstantInitializer<?>)) { return false; } final ConstantInitializer<?> c = (ConstantInitializer<?>) obj; return Objects.equals(getObject(), c.getObject()); }
/** * Returns a string representation for this object. This string also * contains a string representation of the object managed by this * initializer. * * @return a string for this object */ @Override public String toString() { return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)), String.valueOf(getObject())); } }
/** * Returns a string representation for this object. This string also * contains a string representation of the object managed by this * initializer. * * @return a string for this object */ @Override public String toString() { return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)), String.valueOf(getObject())); } }
/** * Returns a string representation for this object. This string also * contains a string representation of the object managed by this * initializer. * * @return a string for this object */ @Override public String toString() { return String.format(FMT_TO_STRING, Integer.valueOf(System.identityHashCode(this)), String.valueOf(getObject())); } }