esoe
2 years ago
7 changed files with 30 additions and 55 deletions
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
package ru.molokoin; |
||||
|
||||
|
||||
|
||||
|
||||
import java.lang.annotation.Annotation; |
||||
|
||||
public class AnnotationReseacher { |
||||
public static File getFile(Storage storage){ |
||||
Annotation fileAnnotation = storage |
||||
.getClass() |
||||
.getAnnotation(File.class); |
||||
File file = (File)fileAnnotation; |
||||
return file; |
||||
} |
||||
public static void print(Storage storage){ |
||||
Annotation fileAnnotation = storage |
||||
.getClass() |
||||
.getAnnotation(File.class); |
||||
File file = (File)fileAnnotation; |
||||
System.out.println(file.name()); |
||||
System.out.println(file.extension()); |
||||
System.out.println(file.size()); |
||||
} |
||||
public static void main(String[] args) { |
||||
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
public class DocumentFile extends File{ |
||||
|
||||
} |
@ -1,16 +1,16 @@
@@ -1,16 +1,16 @@
|
||||
package ru.molokoin; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
public class File { |
||||
String name; |
||||
Byte size; |
||||
Extension extension; |
||||
|
||||
public File (String name, Byte size, Extension extension){ |
||||
|
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
//
|
||||
} |
||||
|
||||
@Inherited |
||||
@Target(ElementType.TYPE) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
public @interface File { |
||||
String name() default "noname"; |
||||
byte size() default 0; |
||||
Extension extension () default Extension.OTHER; |
||||
} |
||||
|
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
c:\Users\Strannik\Documents\esoe\code\education\files\src\main\java\ru\molokoin\DocumentFile.java |
||||
c:\Users\Strannik\Documents\esoe\code\education\files\src\main\java\ru\molokoin\Extension.java |
||||
c:\Users\Strannik\Documents\esoe\code\education\files\src\main\java\ru\molokoin\Storage.java |
||||
c:\Users\Strannik\Documents\esoe\code\education\files\src\main\java\ru\molokoin\File.java |
Loading…
Reference in new issue