Questions tagged [marker-interfaces]
An empty interface in java is called marker interface. Use this tag for questions referring to the Java programming marker interface.
marker-interfaces
60
questions
0
votes
0
answers
16
views
academic/scholarly term for Interface belonging to class library(in a dll or jar file) that must be implemented by the client application code
Let's say one has a Financial Foreign Exchange Processor Class Library called ForeignXchangeProc and a client business application that uses said Class Library.
However, within the ForeignXchangeProc, ...
0
votes
0
answers
63
views
How to enforce a method argument type?
How to enforce that types are part of a super type, that has no properties? The idea is to enforce that only types that share a super type can be passed to a method and no other types.
Assume we have ...
6
votes
1
answer
426
views
Marker Interface To avoid Generic Controllers & Constructor with generic paramaters
I have overridden default IdentityUser and UserStore provided by Microsoft Identity.
public class ApplicationUser<TIdentityKey, TClientKey> : IdentityUser<TIdentityKey>, ...
-2
votes
1
answer
88
views
The following java code is Legal.Why is it legal? [duplicate]
interface P{}
class A{}
class Demo{
public static void main(String arg[]){
A a1=null;
P p1=null;
a1=(A)p1; //legal
p1=(P)a1; //legal
}
}
In this ...
2
votes
2
answers
929
views
Custom Validation Not Working on spring boot
I am trying to implement custom validation in spring boot but there is some issue with the code even if I am passing wrong phone number the phone number should be 10 digit but I am passing a string ...
1
vote
1
answer
162
views
Serialization, compile time check Vs runtime check
When going through how marker interfaces are used in Java, I found writeObject method from ObjectOutputStream class. It receives instance of Object as input and do serialization only when given ...
-1
votes
1
answer
237
views
Is @FunctionalInterface just a marker interface or more than that?
I guess @FuntionalInterface is present even before Java 8 (although not directly named as @FunctionalInterface the interfaces such as Comparator and Comparable that have single method). Is it just a ...
0
votes
0
answers
271
views
Implement Marker Interface in Spring WebServices
I want to implement Marker interface, having two sub-class, something like factory pattern.
public interface TryMarker {
}
Bean 1 with all getters & setters & annotations
public class ...
1
vote
0
answers
23
views
How to create a differentiated marker class hierarchy
I have a case where I have a base interface (X), an updatable interface (updatableX), and a nonUpdatableInterface (frozenX).
frozenX implementations are expected to implement hashCode() and equals() ...
0
votes
0
answers
52
views
Why can't we use clone method by using approch 1(given below) instead of approch 2 and what's need of marker interface? Why jvm handle clone method? [duplicate]
approach 2
/*Using clone method by using marker interface and clone method control by jvm (recommended way)*/
class Employee implements Clonable
{
String name,id;
Employee(String name,String id)
{
...
1
vote
2
answers
2k
views
Is it OK to inherit an empty Interface?
I have this generic method:
public void Send < TBiz, TEntity > (string serviceName, string pkName)
where TEntity: class, IEntity
where TBiz: class, BLL.Modules.INewSend
...
4
votes
4
answers
3k
views
What is the point of marker interface in java and why can't we go on without them?
I have read about marker interfaces and I have developed some understanding as to how they can be used in code but what I don't understand why do we need them and what is the reason that this concept ...
1
vote
4
answers
780
views
What's the good of Marker Interface?
The idea or purpose of the marker interface sounds totally meaningless to me.
While searching for the "Serializable Class" in Java, I inevitably came to this concept, 'Marker Interface'. I understood ...
3
votes
3
answers
3k
views
How/Why can we say that the functional interfaces in java 8 are marker interfaces
In a recent interview I was asked the question that "how can we say that in java8 the functional interfaces are similar to marker interfaces".
I was not able to answer this question.
But I think ...
0
votes
1
answer
587
views
Custom Marker Interface in Java
As Serializable and Cloneable is marker Interface (interface which is not having any method), so if we create our own marker interface then what will be the difference between these two.