mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8370197: Add missing @Override annotations in com.sun.beans package
Reviewed-by: prr
This commit is contained in:
parent
c3449de23f
commit
e7c7892b9f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,7 @@ final class WildcardTypeImpl implements WildcardType {
|
||||
* @return an array of types representing
|
||||
* the upper bound(s) of this type variable
|
||||
*/
|
||||
@Override
|
||||
public Type[] getUpperBounds() {
|
||||
return this.upperBounds.clone();
|
||||
}
|
||||
@ -87,6 +88,7 @@ final class WildcardTypeImpl implements WildcardType {
|
||||
* @return an array of types representing
|
||||
* the lower bound(s) of this type variable
|
||||
*/
|
||||
@Override
|
||||
public Type[] getLowerBounds() {
|
||||
return this.lowerBounds.clone();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,6 +61,7 @@ class NullElementHandler extends ElementHandler implements ValueObject {
|
||||
*
|
||||
* @return {@code null} by default
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return null;
|
||||
}
|
||||
@ -70,6 +71,7 @@ class NullElementHandler extends ElementHandler implements ValueObject {
|
||||
*
|
||||
* @return {@code false} always
|
||||
*/
|
||||
@Override
|
||||
public final boolean isVoid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,6 +72,7 @@ final class ValueObjectImpl implements ValueObject {
|
||||
*
|
||||
* @return the result of method execution
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.value;
|
||||
}
|
||||
@ -82,6 +83,7 @@ final class ValueObjectImpl implements ValueObject {
|
||||
* @return {@code true} if value should be ignored,
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean isVoid() {
|
||||
return this.isVoid;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
public class BooleanEditor extends PropertyEditorSupport {
|
||||
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
@ -41,6 +42,7 @@ public class BooleanEditor extends PropertyEditorSupport {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
Object value = getValue();
|
||||
return (value instanceof Boolean)
|
||||
@ -48,6 +50,7 @@ public class BooleanEditor extends PropertyEditorSupport {
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws java.lang.IllegalArgumentException {
|
||||
if (text == null) {
|
||||
setValue(null);
|
||||
@ -60,6 +63,7 @@ public class BooleanEditor extends PropertyEditorSupport {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTags() {
|
||||
return new String[] {getValidName(true), getValidName(false)};
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
|
||||
public class ByteEditor extends NumberEditor {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
@ -41,6 +42,7 @@ public class ByteEditor extends NumberEditor {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Byte.decode(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -79,16 +79,19 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
resize(ourWidth,40);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
Color c = (Color)o;
|
||||
changeColor(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Dimension preferredSize() {
|
||||
return new Dimension(ourWidth, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean keyUp(Event e, int key) {
|
||||
if (e.target == text) {
|
||||
@ -101,6 +104,7 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
return (false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String s) throws java.lang.IllegalArgumentException {
|
||||
if (s == null) {
|
||||
changeColor(null);
|
||||
@ -124,6 +128,7 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean action(Event e, Object arg) {
|
||||
if (e.target == chooser) {
|
||||
@ -132,6 +137,7 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
return (this.color != null)
|
||||
? "new java.awt.Color(" + this.color.getRGB() + ",true)"
|
||||
@ -165,14 +171,17 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
support.firePropertyChange("", null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaintable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
|
||||
Color oldColor = gfx.getColor();
|
||||
gfx.setColor(Color.black);
|
||||
@ -182,28 +191,34 @@ public class ColorEditor extends Panel implements PropertyEditor {
|
||||
gfx.setColor(oldColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
return (this.color != null)
|
||||
? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue()
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.awt.Component getCustomEditor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCustomEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
support.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
support.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
|
||||
public class DoubleEditor extends NumberEditor {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Double.valueOf(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,10 +63,12 @@ public final class EnumEditor implements PropertyEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue( Object value ) {
|
||||
if ( ( value != null ) && !this.type.isInstance( value ) ) {
|
||||
throw new IllegalArgumentException( "Unsupported value: " + value );
|
||||
@ -92,12 +94,14 @@ public final class EnumEditor implements PropertyEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
return ( this.value != null )
|
||||
? ( ( Enum )this.value ).name()
|
||||
: null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText( String text ) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Object tmp = ( text != null )
|
||||
@ -106,10 +110,12 @@ public final class EnumEditor implements PropertyEditor {
|
||||
setValue(tmp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTags() {
|
||||
return this.tags.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
String name = getAsText();
|
||||
return ( name != null )
|
||||
@ -117,27 +123,33 @@ public final class EnumEditor implements PropertyEditor {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaintable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintValue( Graphics gfx, Rectangle box ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCustomEditor() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getCustomEditor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener( PropertyChangeListener listener ) {
|
||||
synchronized ( this.listeners ) {
|
||||
this.listeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener( PropertyChangeListener listener ) {
|
||||
synchronized ( this.listeners ) {
|
||||
this.listeners.remove( listener );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
|
||||
public class FloatEditor extends NumberEditor {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
@ -41,6 +42,7 @@ public class FloatEditor extends NumberEditor {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Float.valueOf(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,11 +78,13 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Dimension preferredSize() {
|
||||
return new Dimension(300, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object o) {
|
||||
font = (Font) o;
|
||||
if (this.font == null)
|
||||
@ -130,10 +132,12 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
support.firePropertyChange("", null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return (font);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
if (this.font == null)
|
||||
return "null";
|
||||
@ -142,6 +146,7 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
font.getStyle() + ", " + font.getSize() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean action(Event e, Object arg) {
|
||||
String family = familyChoser.getSelectedItem();
|
||||
@ -158,10 +163,12 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isPaintable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {
|
||||
// Silent noop.
|
||||
Font oldFont = gfx.getFont();
|
||||
@ -172,6 +179,7 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
gfx.setFont(oldFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsText() {
|
||||
if (this.font == null) {
|
||||
return null;
|
||||
@ -195,26 +203,32 @@ public class FontEditor extends Panel implements java.beans.PropertyEditor {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Font.decode(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.awt.Component getCustomEditor() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsCustomEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
support.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
support.removePropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,6 +35,7 @@ import java.beans.*;
|
||||
public class IntegerEditor extends NumberEditor {
|
||||
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Integer.decode(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
|
||||
public class LongEditor extends NumberEditor {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
@ -41,6 +42,7 @@ public class LongEditor extends NumberEditor {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Long.decode(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
|
||||
public abstract class NumberEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,6 +35,7 @@ import java.beans.*;
|
||||
|
||||
public class ShortEditor extends NumberEditor {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
return (value != null)
|
||||
@ -42,6 +43,7 @@ public class ShortEditor extends NumberEditor {
|
||||
: "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
setValue((text == null) ? null : Short.decode(text));
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@ import java.beans.*;
|
||||
|
||||
public class StringEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public String getJavaInitializationString() {
|
||||
Object value = getValue();
|
||||
if (value == null)
|
||||
@ -67,6 +68,7 @@ public class StringEditor extends PropertyEditorSupport {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) {
|
||||
setValue(text);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import java.beans.*;
|
||||
public class ComponentBeanInfo extends SimpleBeanInfo {
|
||||
private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||
try {
|
||||
PropertyDescriptor
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -405,11 +405,13 @@ public abstract class Cache<K,V> {
|
||||
*/
|
||||
public static enum Kind {
|
||||
STRONG {
|
||||
@Override
|
||||
<T> Ref<T> create(Object owner, T value, ReferenceQueue<? super T> queue) {
|
||||
return new Strong<>(owner, value);
|
||||
}
|
||||
},
|
||||
SOFT {
|
||||
@Override
|
||||
<T> Ref<T> create(Object owner, T referent, ReferenceQueue<? super T> queue) {
|
||||
return (referent == null)
|
||||
? new Strong<>(owner, referent)
|
||||
@ -417,6 +419,7 @@ public abstract class Cache<K,V> {
|
||||
}
|
||||
},
|
||||
WEAK {
|
||||
@Override
|
||||
<T> Ref<T> create(Object owner, T referent, ReferenceQueue<? super T> queue) {
|
||||
return (referent == null)
|
||||
? new Strong<>(owner, referent)
|
||||
@ -463,6 +466,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the owner of the reference or {@code null} if the owner is unknown
|
||||
*/
|
||||
@Override
|
||||
public Object getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
@ -472,6 +476,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the referred object
|
||||
*/
|
||||
@Override
|
||||
public T getReferent() {
|
||||
return this.referent;
|
||||
}
|
||||
@ -481,6 +486,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return {@code true} if the referred object was collected
|
||||
*/
|
||||
@Override
|
||||
public boolean isStale() {
|
||||
return false;
|
||||
}
|
||||
@ -488,6 +494,7 @@ public abstract class Cache<K,V> {
|
||||
/**
|
||||
* Marks this reference as removed from the cache.
|
||||
*/
|
||||
@Override
|
||||
public void removeOwner() {
|
||||
this.owner = null;
|
||||
}
|
||||
@ -522,6 +529,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the owner of the reference or {@code null} if the owner is unknown
|
||||
*/
|
||||
@Override
|
||||
public Object getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
@ -531,6 +539,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the referred object or {@code null} if it was collected
|
||||
*/
|
||||
@Override
|
||||
public T getReferent() {
|
||||
return get();
|
||||
}
|
||||
@ -540,6 +549,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return {@code true} if the referred object was collected
|
||||
*/
|
||||
@Override
|
||||
public boolean isStale() {
|
||||
return null == get();
|
||||
}
|
||||
@ -547,6 +557,7 @@ public abstract class Cache<K,V> {
|
||||
/**
|
||||
* Marks this reference as removed from the cache.
|
||||
*/
|
||||
@Override
|
||||
public void removeOwner() {
|
||||
this.owner = null;
|
||||
}
|
||||
@ -581,6 +592,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the owner of the reference or {@code null} if the owner is unknown
|
||||
*/
|
||||
@Override
|
||||
public Object getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
@ -590,6 +602,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return the referred object or {@code null} if it was collected
|
||||
*/
|
||||
@Override
|
||||
public T getReferent() {
|
||||
return get();
|
||||
}
|
||||
@ -599,6 +612,7 @@ public abstract class Cache<K,V> {
|
||||
*
|
||||
* @return {@code true} if the referred object was collected
|
||||
*/
|
||||
@Override
|
||||
public boolean isStale() {
|
||||
return null == get();
|
||||
}
|
||||
@ -606,6 +620,7 @@ public abstract class Cache<K,V> {
|
||||
/**
|
||||
* Marks this reference as removed from the cache.
|
||||
*/
|
||||
@Override
|
||||
public void removeOwner() {
|
||||
this.owner = null;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user